2

正規表現を使用して、文字列から先頭と末尾の空白を削除しようとしています

regexQuote = CreateObject("roRegex", "/^[ ]+|[ ]+$/g+", "i")
regexQuote.ReplaceAll(noSpaceString)
print noSpaceString

[編集]

regexQuote = CreateObject("roRegex", "/^[ ]+|[ ]+$/g", "")
print len(noSpaceString) //this value includes leading white spaces, which I dont want

私も試しました

regexQuote = CreateObject("roRegex", "/^[ ]+|[ ]+$/", "")

そして試した

regexQuote = CreateObject("roRegex", "/(^\s*)|(\s*$)/", "")
4

3 に答える 3

-1

ここのコメントセクションのヘルプを使用することが解決策です

regexQuote = CreateObject("roRegex", "^\s+|\s+$", "")
newString= regexQuote.ReplaceAll(oldString, "")
print "string length:" ; len(newString)
于 2014-03-07T00:05:35.737 に答える