J JEG Member Licensed User Longtime User Aug 13, 2017 #1 Dim s1 as string s1=List1.Get(n) s1.trim s1.replace(" ","") s1 still contains spaces. Msgbox(List1.IndexOf(" <Document>"),"") shows this How can the spaces be removed?
Dim s1 as string s1=List1.Get(n) s1.trim s1.replace(" ","") s1 still contains spaces. Msgbox(List1.IndexOf(" <Document>"),"") shows this How can the spaces be removed?
mangojack Expert Licensed User Longtime User Aug 13, 2017 #2 try .. B4X: s1=List1.Get(n) s1 = s1.replace(" ","") Upvote 0
Computersmith64 Well-Known Member Licensed User Longtime User Aug 13, 2017 #3 JEG said: Dim s1 as string s1=List1.Get(n) s1.trim s1.replace(" ","") s1 still contains spaces. Msgbox(List1.IndexOf(" <Document>"),"") shows this How can the spaces be removed? Click to expand... You need to assign the result. Try this: B4X: Private s1 as String = List1.Get(n) s1 = s1.Trim.Replace(" ", "") - Colin. Upvote 0
JEG said: Dim s1 as string s1=List1.Get(n) s1.trim s1.replace(" ","") s1 still contains spaces. Msgbox(List1.IndexOf(" <Document>"),"") shows this How can the spaces be removed? Click to expand... You need to assign the result. Try this: B4X: Private s1 as String = List1.Get(n) s1 = s1.Trim.Replace(" ", "") - Colin.
Erel B4X founder Staff member Licensed User Longtime User Aug 14, 2017 #4 The mistake is here: B4X: s1.trim This line returns a new trimmed string, however you aren't doing anything with the returned string. Correct code: B4X: s1 = s1.Trim Upvote 0
The mistake is here: B4X: s1.trim This line returns a new trimmed string, however you aren't doing anything with the returned string. Correct code: B4X: s1 = s1.Trim