--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(0, 3); //fg
--反向Remove--
python
str = "asdfg" str = str[:3] #asd
c#
var str = "asdfg"; str = str.Remove(str.Length-2, 2); //asd
--SubString取中间段--
python
前后均为索引
str = "asdfg" str = str[1:3] #sd
c#
var str = "asdfg"; str = str.Substring(1, 2); //sd
原文:http://www.cnblogs.com/hont/p/4892694.html