C # truncation and conversion of strings, arrays, and lists,
Using System; using System. collections. generic; using System. diagnostics; using System. linq; using System. text; using System. threading; namespace ConsoleApp1 {class Program {/// <summary> /// string, array and List truncation, convert /// </summary> /// <param name = "args"> </param> static void Main (string [] args) {string str = "abcdefghij1234567890 "; int I = 4; string str1 = str. substring (0, I); // capture the first I bit of the string -- abcd string str2 = str. remove (I, str. length-I); // remove the character after the string I-bit = intercept the first I-bit of the string -- abcd string str3 = str. remove (0, I); // capture the string after the I-bit -- efghij1234567890 string str4 = str. substring (I); // capture the string after I-bit -- efghij1234567890 string str5 = str. substring (str. length-I); // The I-bit after the string is intercepted -- 7890 string str6 = str. remove (0, str. length-I); // The I-bit after the string is intercepted -- 7890 string str7 = str. substring (0, str. length-I); // remove the I-bit after the string -- abcdefghij123456 string str8 = str. remove (str. length-I, I); // after removing the string, I-bit -- abcdefghij123456 string str9 = str. replace ("abc", "ABC"); // Replace the string-ABCdefghij1234567890 string str0 = str. toUpper (); // converts lowercase letters to uppercase letters -- ABCDEFGHIJ1234567890 string str10 = str0.ToLower (); // converts uppercase letters to lowercase letters -- abcdefghij1234567890 string str11 = str. substring (str. length-1, 1); // capture the last digit of the string -- 0 int m = str. indexOf ("cde") + 1; int n = str. indexOf ("23"); string str12 = str. substring (m, n-m + 2); // intercept the range from the start string to the end string -- cdefghij123 string s = "a, B, c, d, e, f, g, h, I, j "; string [] strArray = s. split (','); // string to array string str13 = string. join (",", strArray); // convert an array to a string List <string> list = new List <string> (s. split (','); // string to List string str14 = string. join (",", list. toArray (); // List to string [] str15 = list. toArray (); // convert List to array List <string> listS = new List <string> (str15); // convert array to List Console. writeLine (str0); Console. writeLine (str12); Console. readLine ();}}}