WordRem()

WordRem()

Removes characters from a string

Syntax

      WordRem( <cDeleteThisDoubleCharacters>, <cString> ) -> cReducedString

Arguments

<cDeleteThisDoubleCharacters> specifies the double characters that should be deleted in <cString>

<cString>) is the string that should be processed

Returns

<cReducedString> is a string where the double characters specified in <cDeleteThisDoubleCharacters> are deleted

Description

The WordRem() function deletes the double characters specified in <cDeleteThisDoubleCharacters> from <cString>.

Examples

      ? WordRem( "abcd", "0ab1cd" )   // "0ab1"
      ? WordRem( "abcd", "ab0cd1" )   // "0cd1"

Tests

      WordRem( "abcd", "0ab1cd" ) == "0ab1"
      WordRem( "abcd", "ab0cd1" ) == "0cd1"

Compliance

WordRem() is a new function available only in Harbour’s CT3.

Platforms

All

Files

Source is charonly.c, library is ct3.

Seealso

CHARONLY(), CHARREM(), WORDONLY()

WordOnly()

WordOnly()

Intersectional set of two strings based on double characters

Syntax

      WordOnly( <cThisDoubleCharactersOnly>, <cString> ) -> cReducedString

Arguments

<cThisDoubleCharactersOnly> specifies the double characters that must not be deleted in <cString>.

<cString> is the string that should be processed

Returns

<cReducedString> A string with all double characters deleted but those specified in <cThisCharactersOnly>.

Description

The WordOnly() function calculates the intersectional set of two strings based on double characters. To do this, it deletes all double characters from <cString> that do not appear in <cThisDoubleCharacterOnly>.

Examples

      ? WordOnly( "AABBCCDD", "XXAAYYBBZZ" )  // "AABB"
      ? WordOnly( "AABBCCDD", "XAAYYYBBZZ" )  // "BB"

Tests

      WordOnly( "AABBCCDD", "XXAAYYBBZZ" ) == "AABB"
      WordOnly( "AABBCCDD", "XAAYYYBBZZ" ) == "BB"

Compliance

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

Platforms

All

Files

Source is charonly.c, library is ct3.

Seealso

CHARONLY(), CHARREM(), WORDREM()

WordOne()

WordOne()

Reduce multiple occurences of a double character to one

Syntax

      WordOne( [<cDoubleCharactersToReduce>,] <cString> ) -> cReducedString

Arguments

[<cDoubleCharactersToReduce>] specifies the double 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 WordOne() function reduces multiple occurences of double characters in <cString> to a single one. It is important to note that the multiple occurences must occur directly one behind the other.

Examples

      ? WordOne( "12ABAB12" )       // "12AB12"
      ? WordOne( "1AAAA2" )         // "1AAAA2"
      ? WordOne( "12", "1212ABAB" ) // "12ABAB"

Tests

      WordOne( "12ABAB12" )       == "12AB12"
      WordOne( "1AAAA2" )         == "1AAAA2"
      WordOne( "12", "1212ABAB" ) == "12ABAB"

Compliance

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

Platforms

All

Files

Source is charone.c, library is ct3.

Seealso

CHARONE(), CHARREM()

CharOnly()

CHARONLY()

Intersectional set of two strings based on characters

Syntax

      CHARONLY( <cThisCharactersOnly>, <cString> ) -> cReducedString

Arguments

<cThisCharactersOnly> specifies the characters that must not be deleted in <cString>. <cString> is the string that should be processed

Returns

<cReducedString> A string with all characters deleted but those specified in <cThisCharactersOnly>.

Description

The CHARONLY() function calculates the intersectional set of two strings. To do this, it deletes all characters from <cString> that do not appear in <cThisCharacterOnly>.

Examples

      ? CHARONLY( "0123456789", "0211 - 38 99 77" )  //  "0211389977"
      ? CHARONLY( "0123456789", "0211/ 389 977" )    //  "0211389977"

Tests

      CHARONLY( "0123456789", "0211 - 38 99 77" ) == "0211389977"
      CHARONLY( "0123456789", "0211/ 389 977" )   == "0211389977"

Compliance

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

Platforms

All

Files

Source is charonly.c, library is ct3.

Seealso

CHARREM(), WORDONLY(), WORDREM()

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()

Harbour All Functions – C

CD / CHDIR / DirChange

CDoW

Chr

CharAdd
CharAnd
CharEven
CharHist
CharList
CharMirr
CharMix
CharNoList
CharNot
CharOdd
CharOne
CharOnly
CharOr
CharPix
CharRela
CharRelRep
CharRem
CharRepl
CharRLL
CharRLR
CharSHL
CharSHR
CharSList
CharSort
CharSub
CharSwap
CharWin
CharXOR

CLIPINIT
CMonth

Col

Cos

CosH

CountLeft
CountRight

CToBit

CToD

CToDoW
CToF
CToMonth
CToN

CurDir

CSetArgErr
CSetAtMuPa
CSetRef
CTCExit
CTCInit
CTExit
CTInit

CT_CHARREM

 CHARREM()
 Removes particular characters from a string
------------------------------------------------------------------------------
 Syntax

     CHARREM(<cDelCharacterstring>,<cString>) --> cString

 Arguments

     <cDelCharacterstring>  Designates the characters that are removed
     from <cString>.

     <cString>  Designates the string that is processed.

 Returns

     The processed <cString> is returned.

 Description

     With this function you can remove particular characters from any
     position in <cString>.  It is possible to ensure that the character
     string does not contain these characters later.

 Note

     .  No changes occur if you pass invalid or incorrect parameters.

 Examples

     .  Remove the blanks from a string:

        ? CHARREM(" ", " 1  2   ")     // "12"

     .  Remove the number "3" and the letter "y":

        ? CHARREM("3y", "xyz123")      // "xz12"

See Also: CHARONLY() CHARONE()