Tuesday, 6 August 2013

Split String in Half By Word

Split String in Half By Word

I'm in a situation where I'd like to take a string and split it in half,
respecting words so that this string here doesn't get split into this str
ing here, rather it would be split into this string here.
I figure a starting step would to be to split the string into an array
based on spaces, then calculate length based on those pieces, but in my
attempts longer strings end up being split up incorrectly.

No comments:

Post a Comment