C#经典入门:操作字符串与定位子串

string poem = “In Xanadu did Kubla Khan”;

string poemSeg = poem.Substring(10);

poemSeg = poem.Substring(0,9);

int index = poem.IndexOf(“I”);

index = poem.LastIndexOf(“n”);

bool isMatch;

string title = "Ancient Mariner";

isMatch = (title == "ANCIENT AMRINER");

isMatch = (title.ToUpper() == "ANCIENT MARINER");

isMatch = title.Equals("Ancient Mariner");

ppt 文件大小:4.81MB