usingSystem;namespaceChinese Chinese sort sort{Internal classProgram {/// <summary> ///Take a substring/// </summary> /// <param name= "Oristr" >Original String</param> /// <param name= "Beginindex" >take the starting position of the substring</param> /// <param name= "Len" >take the length of the substring</param> /// <returns>Sub-string</returns> Public StaticString subString (String oristr,intBeginindex,intLen) { intstrlen =oristr.length; Beginindex= Beginindex-1; stringstr =NULL; if(Strlen <=beginindex) {Console.WriteLine (" out of"+ Oristr +"' s length, please recheck!"); } Else if(strlen <= Beginindex +Len) {STR=oristr.substring (Beginindex); } Else{str= Oristr.substring (beginindex, Beginindex +Len); } returnstr; } /// <summary> ///left complement, right-aligned/// </summary> /// <param name= "Oristr" >Original String</param> /// <param name= "Len" >Target String length</param> /// <param name= "Alexin" >complement character</param> /// <returns>Target String</returns> Public StaticString PadRight (String oristr,intLenCharalexin) { intstrlen =oristr.length; stringstr =NULL; if(Strlen <Len) { for(inti =0; i < Len-strlen; i++) {str= str +Alexin; }} str= str +Oristr; returnstr; } /// <summary> ///right-fill, left-justified/// </summary> /// <param name= "Oristr" >Original String</param> /// <param name= "Len" >Target String length</param> /// <param name= "Alexin" >complement character</param> /// <returns>Target String</returns> Public StaticString PadLeft (String oristr,intLenCharalexin) { intstrlen =oristr.length; stringstr =NULL; if(Strlen <Len) { for(inti =0; i < Len-strlen; i++) {str= str +Alexin; }} str= Oristr +str; returnstr; } Private Static voidMain (string[] args) { stringStemp ="0123456789"; Console.WriteLine (Stemp.substring (0,3));//012UInt64 Uintrownum =0; UInt64 sInt= ++Uintrownum; Console.WriteLine (Sint.tostring ());//1Console.readkey (); } }}
[No000089] String (fill-in) left-justified (fill slot) right