c# - How to split a string [closed]

Lu

New Member
\[quote\] Possible Duplicate:
How to split string preserving whole words? \[/quote\]I have the following string:\[code\]string s = "The Electors shall meet in their respective states to vote by ballot for President and Vice-President.";\[/code\]I want to take the first 60 characters and split them into two separate strings each of 30 characters or less. Each string must start with a whole word (no partial word, nor space). So this is the desired result:\[code\]string s1 = "The Electors shall meet in"; // 26 charactersstring s2 = "their respective states to vot"; // 30 characters\[/code\]Thank you.
 
Back
Top