replacePointsInString
Posted: Wed Feb 23, 2011 11:01 am
Hi All,
I want replace all points (point = ".") of a string.
I tried this but it not work and i dont undertand why
the result is
Maeby you have one more elegant.
The result is correct
All the best
Jean-Marc
I want replace all points (point = ".") of a string.
I tried this but it not work and i dont undertand why
Code: Select all
on testReplacePoint pMet
put ".aa,bb,cc." into MyString
if pMet = 1 then
put "." into unSC --•• test1 dont work
end if
if pMet = 2 then
put numtochar(46) into unSC --•• test2 dont work
end if
put replacetext(MyString,unSC,space) into LeT
put empty into TheCTN
put the num of chars of LeT
repeat for each char UnC in LeT
put chartonum(Unc)&"," after TheCTN
end repeat
delete last char of TheCTN
put LeT&return&TheCTN into msg
end testReplacePoint
Before you jump on your keyboard i found an other curious way.
32,32,32,32,32,32,32,32,32,32
Maeby you have one more elegant.
Code: Select all
on testReplacePoint2
put ".aa,bb,cc." into MyString
put empty into MyString2
set the itemdel to "."
repeat for each item myitem in MyString
put myitem after MyString2
end repeat
set the itemdel to ","
put MyString&return&MyString2 into msg
end testReplacePoint2
Someone have an explanation for the first case ?.aa,bb,cc.
aa,bb,cc
All the best
Jean-Marc