删除文本框开头和结尾的空格c#
Delete empty spaces from the beginning and Ending of the textbox c#
如何删除字符串左右两端的所有空格,如下所示:
"hello" return "hello"
"hello " return "hello"
“你好”return"hello"
“你好世界”return"hello world"
textbox1.Text 当点击按钮时
你的textbox1.Text
returns一个字符串。对于任何字符串,您需要做的就是 textbox1.Text.Trim()
,这将删除任何前导或尾随空格
如何删除字符串左右两端的所有空格,如下所示:
"hello" return "hello"
"hello " return "hello"
“你好”return"hello"
“你好世界”return"hello world"
textbox1.Text 当点击按钮时
你的textbox1.Text
returns一个字符串。对于任何字符串,您需要做的就是 textbox1.Text.Trim()
,这将删除任何前导或尾随空格