String application # Region Search character // string STR = "123456"; // foreach (char time in Str) // {// console. writeline ("{0}", time); //} // console. readkey (); # endregion # region determines the letter // console. writeline ("input character"); // char c = (char) console. read (); // If (char. isletter (c) // {// If (char. islower (c) // console. writeline ("lowercase letter? "); // Else // console. writeline ("lowercase letter"); // else // console. writeline ("non-letter"); // console. readkey (); # endregion string location string orgstr1 = "123456789"; string orgstr2 = "3456"; int orgstr3 = orgstr1.indexof (orgstr2, 0); console. writeline ("Location:" + orgstr3.tostring (); console. readkey (); Result: 2 returns the string orgstr = "123456789"; string name = orgstr. substring (2, 4); console. write (name); console. readkey (); Result: 3456 string orgstr = "123456789"; string name = orgstr. substring (3); console. write (name); console. readkey (); Result: 456789
String insertion string orgstr1 = "123456"; string orgstr2 = "789"; string orgstr3 = orgstr1.insert (6, orgstr2); console. writeline (orgstr3); console. readkey (); Result: 123456789
String deletion string orgstr1 = "123456789"; string orgstr2 = orgstr1.remove (); console. writeline (orgstr2); console. readkey (); Result: 1239 if no index is set, the replacement string orgstr1 = "123456"; string orgstr2 = orgstr1.replace ("3", "9") is used by default "); console. writeline (orgstr2); console. readkey (); Result: 129456
Character segment string orastr1 = "A | BB | CCC"; char [] arrag = new char [] {'|'}; string [] orastr2 = orastr1.split (arrag, 3); For (INT I = 0; I <orastr2.length; I ++) {console. writeline (orastr2 [I]);} console. readkey (); Result: a bb ccc
Output character string STR = "123456"; foreach (char time in Str) {console. writeline ("{0}", time) ;}console. readkey ();