SubString的用法,及一个相关例子的解释

SubString的用法,及一个相关例子的解释

题目
SubString的用法,及一个相关例子的解释
public static void Main() {
string [] info = {"Name:Felica Walker","Title:Mz.","Age:47","Location:Paris","Gender:F"};
int found = 0;
Console.WriteLine("The initial values in the array are:");
foreach (string s in info)
Console.WriteLine(s);
Console.WriteLine("{0}We want to retrieve only the key information.That is:",Environment.NewLine);
foreach (string s in info) {
found = s.IndexOf(":");
Console.WriteLine(s.Substring(found + 1).Trim());
}
请高手解释下这段代码的意思.还有substring一般是怎么用,用在什么地方啊?
答案
substring 一般用于提取字符串的String s="青春无悔无悔青春";String result =s.substring(2,6);substring(int beginindex,int endindex)方法用于提取位置beginindex和位置endindex位置之间的字符串部分.特别要注意...
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点

超级试练试题库

© 2017-2019 超级试练试题库,All Rights Reserved.