Bug? Error when using StringFunctions ".Stuff" function

DIYMicha

Member
When I try to replace a substring that isn't present in the string, the function crashes with out of bounds exception.

But should'nt it just do nothing, and return the original string, like in every other BASIC dialect? And speaking of other dialects, why isn't this function called .Replace like in other dialects?

right now I have to combine the .Stuff function with a .InString function to check if the substring is contained...

B4X:
    WikiUrl=InputWiki.Text
        If sf.InString(WikiUrl,".m.")>-1 Then
            WikiUrl = sf.Stuff(WikiUrl,".",".m.")        ' Clean url, replace mobile ".m." to regular desktop url
        End If

Greetings
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…