Reduces adjoining duplicate characters in a string to one character

     CHARONE([<cDeleteCharacters>],<cString>) --> cString


     <cDeleteCharacter>  Designates the characters that have their
     adjoining duplicates removed from <cString>. The default value removes
     all adjoining duplicate characters.

     <cString>  Designates the character string that is processed.


     The processed <cString> is returned.


     CHARONE() searches within the <cString> for repetitions of adjoining
     characters.  When a character is removed, all of the characters but the
     first are deleted.  This differs significantly from the CHARLIST()
     function, where multiple occurrences of characters within the context of
     the string are removed.


     .  Without the <cDeleteCharacter> parameter, all the repeating
        characters are removed.  If the parameter is specified, only those
        characters in <cDeleteCharacter> are removed.


     .  Check for double occurrences of each character in the
        character string:

        ? CHARONE("122333a123")             // "123a123"
        ? CHARONE("A  B  CCCD")             // "A B CD"

     .  Delete multiple side-by-side blanks:

        ? CHARONE(" ", "A  B  A  B")        // "A B A B"

     .  Make the letter "o" only appear once in the character string:

        ? CHARONE("o", "122oooB12o")        // "122oB12"



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.