xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

CharOne()

Removes duplicate adjacent characters from a string.

Syntax

CharOne( [<cDelete>], <cString> ) --> cResult

Arguments

<cDelete>
Passing a character string for <cDelete> restricts the search to the characters contained in it. The default removes all duplicate adjacent characters from <cString>.
<cString>
This is the character string to process.

Return

The function searches for duplicate adjacent characters in <cString> and removes them in the result string.

Note:  the function differs from CharList() which removes all duplicates. CharOne() removes only adjacent duplicates.

Info

See also:CharList(), CharOnly(), CharRem(), WordOne()
Category: CT:String manipulation , Character functions
Source:ct\charone.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example outlines the difference between CharOne()
// and CharList()

   PROCEDURE Main
      LOCAL cString := "11ab12bb33cc"

      ? CharOne( "abc123", cString )  // result: 1ab12b3c

      ? CharList( cString )           // result: 1ab23c

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe