java.lang.String和正则表达式

1.String类简介

String类中相关方法的使用 String[] split(String regex) Splits this string around matches of the given regular expression. String[] split(String regex, int limit) limit代表什么 Splits this string around matches of the given regular expression char[] toCharArray() Converts this string to a new character array String toLowerCase(Locale locale) Converts all of the characters in this String to lower case using the rules of the given Locale. String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale. 对应的还有:toUpperCase String valueOf(java中提供的所有基本类型) 得到一个字符串,和String类的构造函数结合起来理解 String substring(int beginIndex) Returns a string that is a substring of this string String substring(int beginIndex, int endIndex) Returns a string that is a substring of this string 字符串的长度为endindex-beginindex,因此beginindex可以比字符串的长度加1 char charAt(int index) Returns the char value at the specified index

一个使用split()的例子(2019蓝桥杯javaB组省赛 )

人物相关性分析

经验分享 程序员 微信小程序 职场和发展