Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7186813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:42:43+00:00 2026-05-28T18:42:43+00:00

How can I remove a certain character from a string in Nyquist (which is

  • 0

How can I remove a certain character from a string in Nyquist (which is very similar to xlisp) and have the result returned?

I want to count how many “A” there are in a string like “ABBAAAABBBAABAAAB”. (Yes, there are only ‘A’s and ‘B’s in the string.)

Since there is no (count) function in Nyquist I tried something like

(length (remove #\B mystring))

or

(length (remove #\B mystring :test equal))

But it doesn’t work.

Forgetting the character count for a moment, how can I remove the ‘B’s from the string?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:42:44+00:00Added an answer on May 28, 2026 at 6:42 pm

    Will there always be only As and Bs in the string? If not, you might want to do something like

    (remove #\A yourstring :test-not 'char=)
    

    According to the XLISP reference for remove, the Nyquist remove doesn’t deal with strings, only lists. You need to convert a string to a list in order to operate on it this way, but there’s no coerce either. It’s a touch hacky, but the easiest way around it I see is to stream a string and read-char it. This will produce a list of chars that you can then manipulate with remove.

    (defun string->list (a-string)
      (let ((collector nil)
            (stream (make-string-input-stream a-string)))
        (dotimes (c (length a-string) (reverse collector))
          (setf collector (cons (read-char stream) collector)))))
    

    It should now be possible to

    (remove #\A (string->list yourstring) :test-not 'char=)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I remove parts of a string up to a certain character? Ex.)
How do I remove a certain variable from a query string? Say I have
How can I remove certain font size options from the font size selector in
i have a regular expression to remove certain parts from a URI. However it
How can I remove certain items of an array? Let's say I have an
How can I remove certain element inside html()? For instance, I have this html
How can I remove certain attributes such as id, style, class, etc. from HTML
I need to remove certain rows from a table. Which rows must be deleted
I am wondering how can I hide/remove a tag after a certain amount of
I have a <ul> element. How can remove all the <li> elements inside it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.