I am attempting to remove leading and trailing white spaces from my string using regex
regexQuote = CreateObject("roRegex", "/^[ ]+|[ ]+$/g+", "i")
regexQuote.ReplaceAll(noSpaceString)
print noSpaceString
[EDIT]
regexQuote = CreateObject("roRegex", "/^[ ]+|[ ]+$/g", "")
print len(noSpaceString) //this value includes leading white spaces, which I dont want
I also tried
regexQuote = CreateObject("roRegex", "/^[ ]+|[ ]+$/", "")
And tried
regexQuote = CreateObject("roRegex", "/(^\s*)|(\s*$)/", "")
Using help from the comment section here is the solution
Use
trim()
Use
trim()
, Luke! There is a string method just for the purpose:From Roku's
ifString
ops you can useReplace
as: