When copying the online code, often the first column of each line will have a serial number, if one or two rows we can manually remove, but hundreds of rows of time will be very painful.
Here's how to remove the number before the code:
//remove the ordinal from the front of the copy code Static Public stringGetCode (stringPath =NULL) { if(Path = =NULL) path=@"E:/code.txt"; string[] Allcodeline =System.IO.File.ReadAllLines (path, System.Text.Encoding.Unicode); System.Text.StringBuilder STRB=NewSystem.Text.StringBuilder (); Enumerable.range (0, Allcodeline.count ()). ToList (). ForEach (x = { stringOutput =System.Text.RegularExpressions.Regex.Replace (Allcodeline[x]. ToString (). Trim (),"^ (\\d*)",""); Strb. Appendline (output); }); StreamWriter SW=NewStreamWriter (path); Sw. Write (STRB. ToString ()); returnSTRB. ToString (); }
C # Method-Remove code before ordinal