--IndexOf--

python:

inx = str.find("aa")

c#:

var inx = str.IndexOf("aa");

--LastIndexOf--

python

inx  = str.rfind("aa")

c#

var inx = str.LastIndexOf("aa");

--Remove--

python

str = "asdfg"
str = str[3:]
#fg

c#

var str = "asdfg";
str = str.Remove(, );
//fg

--反向Remove--

python

str = "asdfg"
str = str[:-2]
#asd

c#

var str = "asdfg";
str = str.Remove(str.Length-, );
//asd

--SubString取中间段--

python

前后均为索引

str = "asdfg"
str = str[1:3]
#sd

c#

var str = "asdfg";
str = str.Substring(1, 2);
//sd

--TrimStart, TrimEnd--

python

def main():
print "qwe_xxxxx".lstrip("qwe_") #Output:xxxxx #lstrip对应TrimStart
#rstrip对应TrimEnd
#strip为统一删除
#如果不填写参数,默认删除/r/n这类符号

C#

var str = "qwe_xxxxx";

str = str.TrimStart("qwe_")

//Output:xxxxx
05-27 06:04