Revision: 18852
http://harbour-project.svn.sourceforge.net/harbour-project/?rev=18852&view=rev
Author: druzus
Date: 2013-02-15 00:54:04 +0000 (Fri, 15 Feb 2013)
Log Message:
-----------
2013-02-15 01:53 UTC+0100 Przemyslaw Czerpak (druzus/at/
poczta.onet.pl)
* 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
Modified Paths:
--------------
trunk/harbour/ChangeLog.txt
trunk/harbour/include/harbour.hbx
trunk/harbour/src/common/hbfopen.c
trunk/harbour/src/rtl/Makefile
Added Paths:
-----------
trunk/harbour/src/rtl/strxchg.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.