字符串操作
提問人:劉冬梅發(fā)布時(shí)間:2020-10-12
抽取和定位子串
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");
繼續(xù)查找其他問題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評論>>