| |

VerySource

 Forgot password?
 Register
Search
View: 1017|Reply: 7

Find the method to split the string ..

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-23 21:20:01
| Show all posts |Read mode
I am making a simple program for querying student grades, and other aspects have been written. There is a problem that has not been solved. I need a class. The method of the class can handle a string. The first is the student number. First, it is determined whether the student numbers match. If they match, the string is divided into several strings and put into an array of strings. To compare the optimized algorithm
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-2-8 10:30:01
| Show all posts
string.split ("");
Reply

Use magic Report

3

Threads

17

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-2-9 10:45:01
| Show all posts
Upstairs
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-12 00:15:01
| Show all posts
Yes, split
str.split ("[\\s] +");
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-14 21:45:01
| Show all posts
You can also use StringTokenizer
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-15 13:45:02
| Show all posts
The Scanner class has special methods for splitting and finding strings. See the API documentation for details.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-2-15 17:45:01
| Show all posts
Thank you, the problem is solved, there is still such a method in the String class, I can't find it in such a thick <Java technology insider>.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 17:30:01
| Show all posts
what. . . Strange Isn't there a simple way... subString method intercepts characters. . . Ok
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list