After learning this class, I don't feel it will be of any use. The same operation is not as convenient as in the string class, but also using system. Globalization;
Main members:
/* Static Method */stringinfo. getnexttextelement (); // gets the specified element. By default, stringinfo is the first element. gettextelementenumerator (); // gets the stringinfo enumerator. parsecombiningcharacters (); // obtain the int []/* attribute */lengthintextelements composed of serial numbers; // The number of elements; read-only string; // the string of the object; read/write/* object Method */substringbytextelements (); // truncate a string
Constructors and attributes:
Protected void button1_click (Object sender, eventargs e) {stringinfo Sf = new stringinfo ("abcdefg"); int n1 = SF. lengthintextelements; // 7 string S1 = SF. string; // abcdefg textbox1.text = string. concat (N1, "\ n", S1);} protected void button2_click (Object sender, eventargs e) {stringinfo Sf = new stringinfo (); int n1 = SF. lengthintextelements; // 0 string S1 = SF. string; // SF. string = "ABC"; int n2 = SF. lengthintextelements; // 3 string S2 = SF. string; // ABC textbox1.text = string. concat (N1, "\ n", S1, "\ n" + N2, "\ n", S2 );}
Substringbytextelements () method:
Protected void button1_click (Object sender, eventargs e) {stringinfo Sf = new stringinfo ("abcdefg"); string S1 = SF. substringbytextelements (2); // cdefg string S2 = SF. substringbytextelements (2, 3); // CDE textbox1.text = S1 + "\ n" + S2 ;}
Three static methods:
// Stringinfo. getnexttextelement () protected void button#click (Object sender, eventargs e) {string S1 = stringinfo. getnexttextelement ("abcdefg"); // a string S2 = stringinfo. getnexttextelement ("abcdefg", 1); // B textbox1.text = S1 + "\ n" + S2;} // stringinfo. parsecombiningcharacters () protected void button2_click (Object sender, eventargs e) {int [] narr = stringinfo. parsecombiningcharacters ("ASP. net "); textbox1.text = string. join (",", narr); // 0, 1, 2, 3, 4, 5, 6} // stringinfo. gettextelementenumerator (); Use ienumerator requires using system. colleator; protected void button3_click (Object sender, eventargs e) {string STR = "abcdefg"; string S1, S2; S1 = S2 = ""; ienumerator e1 = stringinfo. gettextelementenumerator (STR); While (e1.movenext () {S1 + = string. format ("{0}", e1.current); // a B c d e f g} ienumerator e2 = stringinfo. gettextelementenumerator (STR, 2); While (e2.movenext () {S2 + = string. format ("{0}", e2.current); // c d e f g} textbox1.text = S1 + "\ n" + S2 ;}