|
I wouldn't suggest doing that. If you do, you will need to manually separate the built string from the stringbuilder (the space in particular) to break the first and last name apart. So what you would do is pull the indexOf the space, and then issue a delete giving it the location of the space index (from indexOf) followed by the length of the entire string builder.
Or you can just keep it in two array indexes instead. A String[2] is sufficient for the size required for first and last name. I don't see a reason to use a string builder here if there is intent to change one of the strings.
|