xHarbour Reference Documentation > Function Reference |
Replaces words (2-byte sequences) in a string with a specified word.
WordRepl( <cWordList> , ; <cString> , ; <cReplace , ; [<lSkipWords>]) --> cResult
The function scans <cString> and searches the words specified with <cWordList>. All words found are replaced with the corresponding word listed in <cReplace>. The modified character string is returned.
See also: | CSetAtMuPa(), CharRepl(), CSetRef() |
Category: | CT:String manipulation , Character functions |
Source: | ct\wordrepl.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example displays results of WordRepl() PROCEDURE Main LOCAL cString := "abab12cd1212cdefef" ? WordRepl( "12", cString, "XY" ) // result: ababXYcdXYXYcdefef ? WordRepl( "abef", cString, "RSTU" ) // result: RSRS12cd1212cdTUTU RETURN
http://www.xHarbour.com