Two ways to use whitespace separated Java strings

  • 2020-04-01 03:47:57
  • OfStack

Two ways:

1. String STR = "123 456 789 111";

String [] strArray = STR. Split ("s");

2.String STR = "123 456 789 111";

String [] strArray = STR. Split (" ");

3. Multiple Spaces, no matter how many Spaces there are

String STR = "123 456 789 111";
String [] strArray = STR. Split ("s+");

That's all for this article, I hope you enjoy it.

Please take a moment to share the article with your friends or leave a comment. We sincerely appreciate your support!


Related articles: