CharOne()

CHARONE()

Reduce multiple occurences of a character to one

Syntax

      CHARONE( [<cCharactersToReduce>,] <cString> ) -> cReducedString

Arguments

[<cCharactersToReduce>] specifies the characters the multiple occurences of which should be reduced to one Default: All characters. <cString> specifies the processed string

Returns

<cReducedString> the string with the reduced occurences

Description

The CHARONE() function reduces multiple occurences of characters in <cString> to a single one. It is important to note that the multiple occurences must occur directly one behind the other. This behaviour is is in contrast to the CHARLIST() function.

Examples

      ? CHARONE( "122333a123" )      // "123a123"
      ? CHARONE( "A  B  CCCD" )      // "A B CD"
      ? CHARONE( " ", "A  B  A  B" ) // "A B A B"
      ? CHARONE( "o", "122oooB12o" ) // "122oB12o"

Tests

      CHARONE( "122333a123" )      == "123a123"
      CHARONE( "A  B  CCCD" )      == "A B CD"
      CHARONE( " ", "A  B  A  B" ) == "A B A B"
      CHARONE( "o", "122oooB12o" ) == "122oB12o"

Compliance

CHARONE() is compatible with CT3’s CHARONE().

Platforms

All

Files

Source is charone.c, library is ct3.

Seealso

CHARREM(), WORDONE()

2 responses to “CharOne()

  1. Pingback: Harbour String Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – C | Viva Clipper !

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.