|
Why not just store them in a string array? Use a string builder if you want when you're ready to combine them.
Mm, looks like you may just want to ask for the one name though yeah? in which case you already have a string for the entirety. There's a dozen ways to do this both with and without the string builder, but most of it still stands. If you work directly on the string input instead of worrying about a stringbuilder, you can use split on a regex to give you a string array, or you can use the indexOf for the spaces and substring to pull it apart and separate the strings.
Stringbuilder will work pretty much the same way, target where the space is with the .indexOf(" ") check, and then use delete/append, substring or replace to just do parts of the string.
|