* harbour/include/harbour.hbx
* harbour/src/rtl/Makefile
+ harbour/src/rtl/strxchg.c
+ added new PRG function:
hb_strXChg( <cString>, <cSource> | <acSource>, ;
<cDest> | <acDest> ] ) -> <cResult>
This function allows to easy replace different substrings in
given string.
If 2-nd is string then each character in <cString> which exists
in <cSource> at <n> position is replaced by corresponding character
at <n> position in <cDest> or string from <acDest>[ <n> ]
If 2-nd parameter is array then each <cString> substring which exists
in <acSource> at <n> position is replaced by corresponding character
at <n> position in <cDest> or string from <acDest>[ <n> ].
If <n> is longer then LEN() of <cDest> or <acDest> then given
character/substring is removed from result.
This function should help in code which wrongly uses repeated
StrTran() calls all regex which can change also substituted values.
Examples:
// encode XML value
cXmlText := hb_strXChg( cText, "<>&", { "<", ">", "&" } )
// now decode it to raw text
cText := hb_strXChg( cXmlText, { "<", ">", "&" }, "<>&" )
// strip all digits from string
cNoDigit := hb_strXChg( cText, "0123456789" )
// extract all digits from string
cDigits := hb_strXChg( cText, cNoDigit )
// convert chosen letters to upper case
? hb_strXChg( "hello world, "hlwd", "HLWD" )
* harbour/src/common/hbfopen.c
* added workaround for missing wsystem() in XCC