12-16-2016, 10:18 AM
here's the code, show me how to avoid tmp1 and tmp2 usage if possible to do so
Macro Macro13
Main routine
Function RemplaceMots
Macro Macro13
lpstr s="ceci est mon test olympia venus" <<<<both venus and olympia should be replaced by the uppercased first letter version
RemplaceMots(&s)
out s
;ceci est mon test Olympia Venus <<<<<< wanted result
Main routine
Function RemplaceMots
function $&texte
str s.getmacro("GarderCasse") <<<< in this is replacement words mapping (venus,Venus)
ARRAY(lpstr) tmpArray
lpstr g
IStringMap m._create
m.Flags=1|2
m.AddList(s "csv")
str tmp1=texte
str tmp2=texte
tok tmp1 tmpArray -1 "" 1
for _i 0 tmpArray.len
,g=m.Get(tmpArray[_i])
,if(g)
,,tmp2.findreplace(tmpArray[_i] g)
texte=tmp2