C# Textbox string separation

后端 未结 8 1518
遇见更好的自我
遇见更好的自我 2021-01-22 08:43

I have textbox in c#, contains two or three strings with white spaces. i want to store those strings seperately.please, suggest me any code. thanx.

相关标签:
8条回答
  • 2021-01-22 09:10

    Calling String.Split() with no parameters will force the method to consume all whitespace and only return the separated strings:

    var individualStrings = originalString.Split();
    
    0 讨论(0)
  • 2021-01-22 09:17

    Try this:

            string str = @"this is my string";
            string[] arr = str.Split(new char[] { char.Parse(" ") });
    
    0 讨论(0)
提交回复
热议问题