D
D
Drunya20182018-10-21 19:20:30
Java
Drunya2018, 2018-10-21 19:20:30

Java. How to get all words from a string entered with a space?

I have a string, let's say String text = "aaa bbb ccc ddd". How to get all the words from it if I don't know how many words it will contain.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-10-21
@Drunya2018

String[] words = text.split(" ")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question