class StringExtensions
nagahoge edited this page Dec 1, 2012
·
2 revisions
Same as Ruby's String#split method.
string[] splittedString =
"I am a pen.<br />You are also a pen.<br />He is not a pen.".Split("<br />");
// splittedString: {"I am a pen.", "You are also a pen.", "He is not a pen."}
Same as Ruby's String#split method, passing null or String.Empty value for separator parameter, split string for each word.
string[] words = "I am a pen.".Split(null);
// words : {"I", "am", "a", "pen."}
string[] splittedString =
"I am a pen.<br />You are also a pen.<br />He is not a pen.".Split(
new string[] {"<br />"}, StringSplitOptions.None);