| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Searches a list of characters and replaces them with a corresponding list.
CharRepl( <cSearch> , ;
<cString> , ;
<cReplace>, ;
[<lOnePass>] ) --> cResult
The function returns a string where all characters contained in <cSearch> are replaced with the corresponding characters of <cReplace>. The string <cString> is returned unchanged when no character of <cSearch> is found.
| See also: | PosRepl(), RangeRepl(), WordRepl(), WordToChar() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\charrepl.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows results of CharRepl()
PROCEDURE Main
LOCAL cString := "xHarbour compiler"
? CharRepl( "aeiou", cString, "AEIOU" ) // result: xHArbOUr cOmpIlEr
? CharRepl( "xmr" , cString, "123" ) // result: 1Ha3bou3 co2pile3
RETURN
http://www.xHarbour.com