Android Question [B4X] Regex - remove whitespaces

Alexander Stolte

Expert
Licensed User
Longtime User
Hey,

i found this code on stackoverflow to remove whitespaces:
B4X:
st.replaceAll("\\s","")
on B4A i tried this:
B4X:
Regex.Replace("\\s",New, "")
but it is not working.
 

Mahares

Expert
Licensed User
Longtime User
The OP may have a reason for using RegEx, but for those of us who get intimidated by RegEx, for simple replacement, I use:
B4X:
str=str.Replace(" ","")
instead of:
B4X:
str= Regex.Replace("\s", str, "")
Both are equivalent.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top