Bug? trim function seems not to work

ilan

Expert
Licensed User
Longtime User
i am not sure if it is a bug what it seem like the trim function in b4i is not working

code:

B4X:
Dim test1 As String = "ilan 123"
    Log(test1.Trim)

log:


the space should be removed when i call .trim, or am i wrong?
 

MikeH

Well-Known Member
Licensed User
Longtime User
Trim takes space from the ends, not within the string
 

ilan

Expert
Licensed User
Longtime User
Trim takes space from the ends, not within the string

its says "leading or trailing" so i guess only if the space is in the start of the string or in the end. so only option for me would be

B4X:
.Replace(" ","")
 

MikeH

Well-Known Member
Licensed User
Longtime User
its says "leading or trailing" so i guess only if the space is in the start of the string or in the end. so only option for me would be

B4X:
.Replace(" ","")

Yes, thats what I meant and yes, .replace is the answer.
 

sorex

Expert
Licensed User
Longtime User
right, it's leading and strailing from the entire string, not words inside the string.
 
Top