Home > Article > Backend Development > Example code for string splitting
string agentInfo = userInfo.Attribute19.ToString();
string[] myAgent = agentInfo.Split(new string[] { "$#$" }, StringSplitOptions.None);
(myAgent.Length == 3)
# # This.QCalenderEndDate.Value = myAgent[2].ToString();
}
Use the following method under VS2003:
1. Separate by string:
using System.Text.RegularExpressions;
Output result:
aaabbb
ccc
2. Use multiple characters to separate:
string str="aaajbbbscccjdddseee ";
string[] sArray=str.Split(new char[2]{'j','s'});foreach(string i in sArray) Response.Write( i.ToString() + "Output result:
aaabbb
ccc
ddd
eee
3. Use a single character to separate:
string str="aaajbbbjccc";
string[] sArray=str.Split('j');foreach(string i in sArray) Response.Write(i.ToString() + "aaa
bbb
ccc
The above is the detailed content of Example code for string splitting. For more information, please follow other related articles on the PHP Chinese website!