String array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

String array

Hello everyone, can you help me. I want to break a sentence to words. How can I transfer them into string array and declare it?

17th Apr 2021, 7:55 AM
TeaserCode
3 Answers
+ 3
This code works without knowing how long is an input string: https://code.sololearn.com/c1V2mmgE7qNv/?ref=app
17th Apr 2021, 2:12 PM
JaScript
JaScript - avatar
+ 1
This will help you. https://code.sololearn.com/cYJmgppdI5mn/?ref=app Addendum: this was only meant to be an idea of how it could be done and not a solution.
17th Apr 2021, 8:36 AM
JaScript
JaScript - avatar
0
Martin, yes I agree with you. My basic question is how to drive all words into one string array. With this I shall inicial and declare string array with these words. I know that it is possible to break string with fundamental string functions such as: length, find, substr, erase. With your answer I am satisied because you don't know how long could be a string. It can be few words or thousend. But for now I still haven't known the header sstream so I must to check it out more carefully.
17th Apr 2021, 12:07 PM
TeaserCode