for example
string test = "extract substring from a string"; // e开发者_开发知识库xtract this in to
extract
substring
from
a
string
in .net2 thank you
You're looking for String.Split
.
test.Split(" \t\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
The substring function has 2 overloads as follows:
Substring(int startIndex)
Substring(int startIndex, int length)
1st type of Substring overloaded function accepts only single parameter as integer type starting index of the character position in the specified string. 2nd type Substring overloaded function accepts two types of parameters, first as integer type starting index of the character position in the string and second parameter as the integer type length or the number of characters to be returned as the substring of specified string.
string t = string.join("\n", test.split(" "));
精彩评论