当前位置:编程学习 > C#/ASP.NET >>

比较容易忘记字符串处理,请大家花两份中看下,呵呵

java中处理字符串:

public int indexOf(int ch)      搜索第一个出现的字符串

public int indexOf(String value)        搜索第一个出现的字符串

public int lastIndexOf(int ch)            搜索最后一个出现的字符

public int lastIndexOf(String value)        搜索最后一个出现的字符

public String substring(int index)          搜索从索引位置开始的字符串

public String substring(int beginindex,int endindex)    提取beginindex和endindex的字符串

public String trim()                        返回一个不含空格的字符串


javascript字符串对象

indexOf("子字符串",起始位置)                查找文本(子字符串)第一个出现的位置,-1表示没有出现

charAt(index)                               获取位于指定位置的字符

substring(index1,index2)                获取包含index1,index2对应的字符,并且包含index1的字符,不包含index2

toLowerCase()                           将字符串转换为小写

toUpperCase()                           将字符串转换为大写





.net中处理字符串

int indexOf(string value)               没有找到匹配字符串则返回-1

int LastIndexOf(string separator)

string Join(strng separator,string[] value)     把value中每个字符串用指定separator连接

string[] Split(char separator)                  用指定separator分割字符串,返回分割后字符串的数组

string SubString(int begin,int length)          从指定位置begin开始返回字符串长度为length的字符串

string ToLower()                                获得字符串的小写形式、

string ToUper()                                 获得字符串的大写形式

string Trim()                                   取出字符串两边的空格

--------------------编程问答-------------------- 最最基本的和常用的几个函数怎么可以忘呢? --------------------编程问答-------------------- 经常总结挺好的! --------------------编程问答-------------------- 浏览了 不错
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,