/// <summary> ///take text left content/// </summary> /// <param name= "str" >text</param> /// <param name= "S" >identifiers</param> /// <returns>left content</returns> Public Static stringGetLeft (stringStrstrings) {stringtemp = str. Substring (0, str. IndexOf (s)); returntemp; } /// <summary> ///take text to the right content/// </summary> /// <param name= "str" >text</param> /// <param name= "S" >identifiers</param> /// <returns>Right Content</returns> Public Static stringGetRight (stringStrstrings) {stringtemp = str. Substring (str. IndexOf (s), str. Length-str.substring (0, str. IndexOf (s)). Length); returntemp; } /// <summary> ///take text intermediate content/// </summary> /// <param name= "str" >Original Text</param> /// <param name= "Leftstr" >left Text</param> /// <param name= "Rightstr" >Right Text</param> /// <returns>return Intermediate text content</returns> Public Static stringBetween (stringStrstringLEFTSTR,stringrightstr) { inti = str. IndexOf (LEFTSTR) +Leftstr. Length; stringtemp = str. Substring (i, str.) IndexOf (RIGHTSTR, i)-i); returntemp; } /// <summary> ///take text middle to list collection/// </summary> /// <param name= "str" >text string</param> /// <param name= "Leftstr" >left Text</param> /// <param name= "Rightstr" >Right Text</param> /// <returns>List Collection</returns> Publiclist<string> Betweenarr (stringStrstringLEFTSTR,stringrightstr) {List<string> list =Newlist<string>(); intLeftindex = str. IndexOf (LEFTSTR);//left text start position intLeftlength = Leftstr. Length;//left text length intRightindex =0; stringtemp =""; while(Leftindex! =-1) {Rightindex= str. IndexOf (RIGHTSTR, Leftindex +leftlength); if(Rightindex = =-1) { Break; } temp= str. Substring (Leftindex + leftlength, Rightindex-leftindex-leftlength); List. ADD (temp); Leftindex= str. IndexOf (LEFTSTR, Rightindex +1); } returnlist; } /// <summary> ///specify text in reverse/// </summary> /// <param name= "str" >text</param> /// <returns>Reverse Text</returns> Public Static stringStrReverse (stringstr) { Char[] chars =Str. ToCharArray (); StringBuilder SB=NewStringBuilder (); for(inti =0; I < chars. Length; i++) {sb. Append (Chars[chars. Length-1-i]); } returnsb. ToString (); }
C # string manipulation takes text to the left to take text to the right of the middle of the text to the middle of the list to specify the text in reverse