How do I remove whitespace at the beginning of my

2019-07-29 05:16发布

Let's say I have following string: string test = " False";

I can't loop the characters of the string because I need to do this for 1744 strings, then it would be a lot of work.

Do you know if there is a method from Microsoft that I can use to delete this whitespace?

Like this: string test2 = test.DeleteFirstWhitespace();

Thanks

8条回答
何必那么认真
2楼-- · 2019-07-29 05:54

how about using the trim() function:

string test = test.trim();
查看更多
贼婆χ
3楼-- · 2019-07-29 05:54

In java:

Use trim() to remove the whitespaces around a String:

String test2 = test.trim();

Returns a copy of the string, with leading and trailing whitespace omitted.

查看更多
登录 后发表回答