文件名称:字符串操作
抽取和定位子串-C#教程实用版 ppt
文件大小:4.81MB
文件格式:PPT
更新时间:2021-04-23 19:46:35
C#教程实用版 ppt
字符串操作
抽取和定位子串
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");