Traditional Culture Encyclopedia - Photography and portraiture - Java problem: extract numbers separated by spaces from strings
Java problem: extract numbers separated by spaces from strings
If you say "extract numbers separated by spaces from a string"
The following method is correct: "Take out the data separated by spaces"
string str = " 16 5 12 136 ";
string[]s = str . split(" ");
//You can convert the obtained value into int.
for(int I = 0; I<s. Length; i++) {
system . out . println(s[I]);
}
If you follow the example you gave: "If the string" 16 5 12 136 "is output as: 165 12 136".
Then the following should be correct.
string str = " 16 5 12 136 ";
string[]s = str . split(" ");
//You can convert the obtained value into int.
for(int I = 0; I<s. Length; i++) {
system . out . print(s[I]);
} so you can output the results you want.
- Related articles
- Poems praising scenery and beauty.
- How to turn on the wide-angle mode of vivo mobile phone
- How many days can the graduation project of film and television photography and production be completed?
- Where can I have digital camera maintenance in Xiaoshan?
- Where are all the reversing cameras installed?
- How about wedding photography microfilm?
- What sideline do college students do to make money?
- What should the baby pay attention to when taking a one-year-old photo?
- A Qin & Huahua daughter is the most beautiful creation.
- What is the historical evolution of Guangdong Xin 'an Vocational and Technical College?