Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想删除字符串中的所有空格字符。例如我的字符串是“Hello World”,我想要的输出是“HelloWorld”
当我使用此代码时:
str.Replace(Chr(39), "")
输出是:“Hello World”
有剩余空间
你只需要使用:String.Replace
str.Replace(" ", "");
并删除前导/尾随空格:String.Trim
str.Trim();
输出:HelloWorld
HelloWorld
May also try this: Trim(Replace("Hello World", " ", ""))
只需使用str.Replace(" ", "").
str.Replace(" ", "")
Dim MyString as String= "Hello World = Trim(Replace(MyString, " ", ""))