EdsonZanatta Member Sep 15, 2023 #1 Friends, how to use the trim() function to remove white spaces from text?
W walt61 Active Member Licensed User Longtime User Sep 16, 2023 #2 B4X: Dim s As String = " ABC " Log(s.Trim) Upvote 1
BlueVision Active Member Licensed User Longtime User Sep 16, 2023 #3 You can put it as a "suffix" to almost any type of string. Try to append ".Trim" within the IDE. There is also a combination of Suffixes possible: Example: Dim sample As String = " My NaMe Is DoNaLd DuCk " Log(sample.Trim.ToLowerCase) Log(sample.Trim.ToUpperCase) Log(sample.SubString2(3,6)) 1st log-line creates -> 'my name is donald duck' 2nd log-line creates -> 'MY NAME IS DONALD DUCK' 3rd log-line creates -> 'y N' Play with it! Upvote 0
You can put it as a "suffix" to almost any type of string. Try to append ".Trim" within the IDE. There is also a combination of Suffixes possible: Example: Dim sample As String = " My NaMe Is DoNaLd DuCk " Log(sample.Trim.ToLowerCase) Log(sample.Trim.ToUpperCase) Log(sample.SubString2(3,6)) 1st log-line creates -> 'my name is donald duck' 2nd log-line creates -> 'MY NAME IS DONALD DUCK' 3rd log-line creates -> 'y N' Play with it!
LucaMs Expert Licensed User Longtime User Sep 16, 2023 #4 BlueVision said: 'MY NAME IS DONALD DUCK' Click to expand... I KNEW!!! ? [Sorry, I couldn't resist the temptation ? ] Upvote 0
BlueVision said: 'MY NAME IS DONALD DUCK' Click to expand... I KNEW!!! ? [Sorry, I couldn't resist the temptation ? ]
BlueVision Active Member Licensed User Longtime User Sep 16, 2023 #5 Still missing your new avatar Luca... Upvote 0
Cableguy Expert Licensed User Longtime User Sep 16, 2023 #6 EdsonZanatta said: Friends, how to use the trim() function to remove white spaces from text? Click to expand... Trim function only removes trailling spaces!!!! as oposed to all spaces in a string. Upvote 0
EdsonZanatta said: Friends, how to use the trim() function to remove white spaces from text? Click to expand... Trim function only removes trailling spaces!!!! as oposed to all spaces in a string.
E emexes Expert Licensed User Sep 17, 2023 #7 Cableguy said: Trim function only removes trailling spaces!!!! as oposed to all spaces in a string. Click to expand... if to remove all spaces, then we've done a full lap and are back to pre-Trim solutions: https://www.b4x.com/android/forum/t...m-beginning-and-end-of-strings.749/#post-3814 Upvote 0
Cableguy said: Trim function only removes trailling spaces!!!! as oposed to all spaces in a string. Click to expand... if to remove all spaces, then we've done a full lap and are back to pre-Trim solutions: https://www.b4x.com/android/forum/t...m-beginning-and-end-of-strings.749/#post-3814
teddybear Well-Known Member Licensed User Sep 17, 2023 #8 Cableguy said: Trim function only removes trailling spaces!!!! as oposed to all spaces in a string. Click to expand... Actually the trim will return a copy of orignal string without any leading or trailing white spaces in B4X. Upvote 0
Cableguy said: Trim function only removes trailling spaces!!!! as oposed to all spaces in a string. Click to expand... Actually the trim will return a copy of orignal string without any leading or trailing white spaces in B4X.
Theera Well-Known Member Licensed User Longtime User Sep 17, 2023 #9 If you used to vb6.0 coding,try using B4XStringFunctionVB. Attachments B4XStringFunctionVB.b4xlib 6.3 KB · Views: 91 Upvote 0
LucaMs Expert Licensed User Longtime User Sep 17, 2023 #10 Cableguy said: Trim function only removes trailling spaces!!!! as oposed to all spaces in a string. Click to expand... To remove ALL spaces: B4X: Var = Var.Replace(" ", "") Upvote 0
Cableguy said: Trim function only removes trailling spaces!!!! as oposed to all spaces in a string. Click to expand... To remove ALL spaces: B4X: Var = Var.Replace(" ", "")