位置:首页 > 软件操作教程 > 编程开发 > C# > 问题详情

字符串操作

提问人:刘冬梅发布时间: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");

继续查找其他问题的答案?

相关视频回答
回复(0)
返回顶部