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()
Pingback: Harbour String Functions | Viva Clipper !
Pingback: Harbour All Functions – C | Viva Clipper !