String.常用的属性方法
来源:互联网 发布:seo 内链 外链 编辑:程序博客网 时间:2024/05/22 10:34
String.ToLower() 方法: 返回此 String 的小写形式的副本。
String.ToUpper() 方法: 返回此 String 的大写形式的副本。
String.TrimEnd() 方法: 从此实例的末尾移除一组指定字符的所有匹配项。。
String.TrimStart() 方法: 从此实例的开始位置移除一组指定字符的所有匹配项。。
String.Trim () 方法: 从此实例的开始位置和末尾移除一组指定字符的所有匹配项。。
String.StartsWith 属性 确定此实例的开始处是否与指定的 String 匹配。
String.EndsWith 属性 确定此实例的末尾是否与指定的 String 匹配。
Label1.Text = "asdfasdf.exe";
Label2.Text = (Label1.Text.EndsWith(".exe")).ToString();
Label3.Text = "asdfasdfasdfexe";
Label4.Text = (Label3.Text.EndsWith(".exe")).ToString();
String.Length 属性 获取此实例中的字符数。
String.IndexOf 属性 在此实例中的第一个匹配项的索引或一个或多个字符的索引。
String.IndexOfAny 属性 报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的索引。
String.LastIndexOfAny 属性 报告在 Unicode 数组中指定的一个或多个字符在此实例中的最后一个匹配项的索引位置。
String.LastIndexOf 指定的 Unicode 字符或 String 在此实例中的最后一个匹配项的索引位置。
Label1.Text = "asd.fasdf.exe";
Label2.Text = (Label1.Text.LastIndexOf(".")).ToString();
String.Substring(int开始位置,int长度) 方法 从此实例检索子字符串。
Label1.Text = "asdfasdf.exe";
Label2.Text = Label1.Text.Substring(Label1.Text.LastIndexOf("."),(Label1.Text.Length-Label1.Text.LastIndexOf("."))).ToString();
String.Replace 将此实例中的指定 Unicode 字符或 String 的所有匹配项替换为其他指定的 Unicode 字符或 String。
Label1.Text = "asdfasdf.exe";
Label2.Text = Label1.Text.Replace("asd","XXX");
String.Remove 方法 从此实例中的指定位置开始删除指定数目的字符。
string.Remove(int 开始删除字符的位置,int 要删除的字符数);
Label1.Text = "asdfasdfa asdf adf asdf asdf asdf asdf asdf asdf asdf asdf .exe";
Label2.Text = Label1.Text.Remove(15,Label1.Text.Length-15)+"...";
String.ToUpper() 方法: 返回此 String 的大写形式的副本。
String.TrimEnd() 方法: 从此实例的末尾移除一组指定字符的所有匹配项。。
String.TrimStart() 方法: 从此实例的开始位置移除一组指定字符的所有匹配项。。
String.Trim () 方法: 从此实例的开始位置和末尾移除一组指定字符的所有匹配项。。
String.StartsWith 属性 确定此实例的开始处是否与指定的 String 匹配。
String.EndsWith 属性 确定此实例的末尾是否与指定的 String 匹配。
Label1.Text = "asdfasdf.exe";
Label2.Text = (Label1.Text.EndsWith(".exe")).ToString();
Label3.Text = "asdfasdfasdfexe";
Label4.Text = (Label3.Text.EndsWith(".exe")).ToString();
String.Length 属性 获取此实例中的字符数。
String.IndexOf 属性 在此实例中的第一个匹配项的索引或一个或多个字符的索引。
String.IndexOfAny 属性 报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的索引。
String.LastIndexOfAny 属性 报告在 Unicode 数组中指定的一个或多个字符在此实例中的最后一个匹配项的索引位置。
String.LastIndexOf 指定的 Unicode 字符或 String 在此实例中的最后一个匹配项的索引位置。
Label1.Text = "asd.fasdf.exe";
Label2.Text = (Label1.Text.LastIndexOf(".")).ToString();
String.Substring(int开始位置,int长度) 方法 从此实例检索子字符串。
Label1.Text = "asdfasdf.exe";
Label2.Text = Label1.Text.Substring(Label1.Text.LastIndexOf("."),(Label1.Text.Length-Label1.Text.LastIndexOf("."))).ToString();
String.Replace 将此实例中的指定 Unicode 字符或 String 的所有匹配项替换为其他指定的 Unicode 字符或 String。
Label1.Text = "asdfasdf.exe";
Label2.Text = Label1.Text.Replace("asd","XXX");
String.Remove 方法 从此实例中的指定位置开始删除指定数目的字符。
string.Remove(int 开始删除字符的位置,int 要删除的字符数);
Label1.Text = "asdfasdfa asdf adf asdf asdf asdf asdf asdf asdf asdf asdf .exe";
Label2.Text = Label1.Text.Remove(15,Label1.Text.Length-15)+"...";
- String.常用的属性方法
- string类的常用属性和方法
- String常用方法及属性
- String常用属性和方法
- 课后作业(五)String对象的常用属性和方法
- String的常用方法
- String常用的方法
- String常用的方法
- String常用的方法
- string的常用方法
- String 的常用方法
- String的常用方法
- String 的常用方法
- String的常用方法
- String常用的方法
- String的常用方法
- String常用的方法
- String的常用方法
- sql server中order by部分使用方式
- 大狗棒法——破解软件狗参考
- 什么是initrd[转载]
- sql按一列筛选,不显示重复行
- Html页面窗口闪烁的一种常见原因--高度、宽度调整
- String.常用的属性方法
- 如何从开发人员走向架构师
- 随机函数
- Python Interfaces are not Java Interfaces
- 指针数组等基础
- 在VC环境下怎样遍历文件夹中的文件
- 汉字转化成拼音的源代码
- strtok函数
- 在MOSS中直接嵌入ASP.NET Page