当前位置: 首页 > news >正文

怎么里ip做网站深圳网站设计公司排行

怎么里ip做网站,深圳网站设计公司排行,黄冈app下载推广平台官网,六安马昌友目录 一、int length():返回字符串的长度 二、char charAt(int index):返回某索引处的字符 三、boolean isEmpty():判断字符串是否为空 四、String toUpperCase():将字符转换成大写 五、String toLowerCase():将字符转换成小写 六、String trim():去除首尾空白…

目录

一、int length():返回字符串的长度

二、char charAt(int index):返回某索引处的字符

三、boolean isEmpty():判断字符串是否为空

四、String toUpperCase():将字符转换成大写

五、String toLowerCase():将字符转换成小写

六、String trim():去除首尾空白字符

七、boolean equals(Object obj):比较字符串的内容是否相等

八、boolean equalsIgnoreCase(String anotherString):忽略大小写比较字符串内容是否相等

九、int compareTo(String anotherString):比较两个字符串的大小

十、String subStriing(int beginIndex):返回一个新的字符串,它是原字符串从beginIndex开始截取到原字符串结尾的一个子字符串

十一、String subStriing(int beginIndex,int endIndex):返回一个新的字符串,它是原字符串从beginIndex开始截取到endIndex(不包含)的一个子字符串

十二、boolean endsWith(String suffix):测试此字符串是否以指定后缀结尾

十三、boolean startsWith(String prefix):测试此字符串是否以指定前缀开始

十四、boolean startsWith(String prefix,int toffset):测试此字符串是否从指定索引开始的子字符串是否以制定前缀开始

十五、boolean contains(CharSequence s): 判断当前对象代表的字符串是否包含参数字符串内容

十六、int indexOf(String str):返回指定子字符串在此字符串中第一次出现处的索引

十七、int indexOf(String str, int fromIndex):返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始

十八、int lastindexOf(String str):返回指定子字符串在此字符串中最右边出现处的索引

十九、int lastIndexOf(String str, int fromIndex):返回指定子字符串在此字符串中最后一次出现处的索引,从指定的索引开始反向搜索

注: indexOf和lastIndexOf方法如果未找到都是返回-1

二十、String replace(char oldChar, char newChar):返回一个新的字符串,它是通过用newChar替换此字符串中出现的所有oldChar得到的。

二十一、String replace(CharSequence target, CharSequence replacement): 使用指定的字面值替换序列替换此字符串所有匹配字面值目标序列的子字符串。

二十二、String replaceAll(String regex, String replacement): 使用给定的replacement替换此字符串所有匹配给定的正则表达式的子字符串。

二十三、String replaceFirst(String regex, String replacement): 使用给定的replacement替换此字符串匹配给定的正则表达式的第一个子字符串。

二十四、StringD split(String regex):根据给定正则表达式的匹配拆分此字符串

二十五、StringD split(String regex, int limit): 根据匹配给定的正则表达式来拆分此字符串,最多不超过limit个,如果超过了,剩下的全部都放到最后一个元素中


一、int length():返回字符串的长度

二、char charAt(int index):返回某索引处的字符

三、boolean isEmpty():判断字符串是否为空

四、String toUpperCase():将字符转换成大写

五、String toLowerCase():将字符转换成小写

六、boolean equals(Object obj):比较字符串的内容是否相等

七、boolean equalsIgnoreCase(String anotherString):忽略大小写比较字符串内容是否相等

代码实现:

public class summary10 {public static void main(String[] args) {String str1 = "HelloWorld";String str2 = "";System.out.println(str1.length());//获取字符串的长度 10System.out.println(str1.charAt(0));//获取字符串指定索引处的字符 HSystem.out.println(str1.isEmpty());//判断字符穿是否为空 falseSystem.out.println(str2.isEmpty());//truestr2 =str1.toUpperCase();//将字符串所有小写变为大写 System.out.println(str1);//HelloWorldSystem.out.println(str2);//HELLOWORLDstr2 = str2.toLowerCase();//将字符串所有大写变为小写System.out.println(str2);//helloworldSystem.out.println(str1.equals(str2));//比较字符串的内容是否相同 falseSystem.out.println(str1.equalsIgnoreCase(str2));//与equals相同但是忽略大小写 true}
}

八、String trim():去除首尾空白字符

九、int compareTo(String anotherString):比较两个字符串的大小

十、String subStriing(int beginIndex):返回一个新的字符串,它是原字符串从beginIndex开始截取到原字符串结尾的一个子字符串

十一、String subStriing(int beginIndex,int endIndex):返回一个新的字符串,它是原字符串从beginIndex开始截取到endIndex(不包含)的一个子字符串

代码实现:

public class Symmary02 {public static void main(String[] args) {String str1 = "   he llo world   ";System.out.println(str1);System.out.println(str1.trim());//去除字符串两边的空格String str2 = "abc";String str3 = "aAb";System.out.println(str2.compareTo(str3));//比较两个字符串的大小 33System.out.println(str2.compareToIgnoreCase(str3));//与compareTo相同但是忽略大小写 1//涉及到字符串排序//该方法用于两个相同数据类型的比较,两个不同类型的数据不能用此方法来比较。String str4 = "沧海月明珠有泪,蓝田日暖玉生烟";System.out.println(str4.substring(8));//返回一个新的字符串,它是字符串从beginIndex开始截取到最后的一个子字符串。System.out.println(str4.substring(1,3));//返回一个新的字符串,它是字符串从beginIndex开始截取到endIndex(不包含)的子字符串。System.out.println(str4);}
}

 

图1  

十二、boolean endsWith(String suffix):测试此字符串是否以指定后缀结尾

十三、boolean startsWith(String prefix):测试此字符串是否以指定前缀开始

十四、boolean startsWith(String prefix,int toffset):测试此字符串是否从指定索引开始的子字符串是否以制定前缀开始

十五、boolean contains(CharSequence s): 判断当前对象代表的字符串是否包含参数字符串内容

十六、int indexOf(String str):返回指定子字符串在此字符串中第一次出现处的索引

十七、int indexOf(String str, int fromIndex):返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始

十八、int lastindexOf(String str):返回指定子字符串在此字符串中最右边出现处的索引

十九、int lastIndexOf(String str, int fromIndex):返回指定子字符串在此字符串中最后一次出现处的索引,从指定的索引开始反向搜索

注: indexOf和lastIndexOf方法如果未找到都是返回-1

代码实现:

public class Summary03 {public static void main(String[] args) {String str1 = "helloworld";//测试此字符串是否以指定的后缀结束System.out.println(str1.endsWith("rld"));//true//测试此字符串是否以指定的前缀开始System.out.println(str1.startsWith("He"));//false//测试此字符串从指定的索引开始的子字符串是否以指定前缀开始System.out.println(str1.startsWith("low",3));//true//当且仅当此字符串包含指定的char值序列时,返回trueSystem.out.println(str1.contains("wor"));//true//找到返回下标位置,找不到返回 -1System.out.println(str1.indexOf("wo"));//5System.out.println(str1.indexOf("rrr"));//-1System.out.println(str1.indexOf('o',5));//6  以最终位置为准System.out.println(str1.lastIndexOf("o"));//6  System.out.println(str1.lastIndexOf("o",5));//4}
}

二十、String replace(char oldChar, char newChar):返回一个新的字符串,它是通过用newChar替换此字符串中出现的所有oldChar得到的。

二十一、String replace(CharSequence target, CharSequence replacement): 使用指定的字面值替换序列替换此字符串所有匹配字面值目标序列的子字符串。

二十二、String replaceAll(String regex, String replacement): 使用给定的replacement替换此字符串所有匹配给定的正则表达式的子字符串。

二十三、String replaceFirst(String regex, String replacement): 使用给定的replacement替换此字符串匹配给定的正则表达式的第一个子字符串。

代码实现:

public class Summary04 {public static void main(String[] args) {String str1 = "茕茕白兔,东走西顾,衣不如新,人不如故";String str2 = str1.replace('白', '黑');System.out.println(str1);//茕茕白兔,东走西顾,衣不如新,人不如故System.out.println(str2);//茕茕黑兔,东走西顾,衣不如新,人不如故String str3 = str1.replace("黑","白");System.out.println(str3);//茕茕白兔,东走西顾,衣不如新,人不如故String str = "12hello34world5456java64142mysql594";System.out.println(str.replaceAll("\\d+",",").replaceAll(","," "));//使用给定的replacement替换此字符串匹配给定的正则表达式的第一个子字符串。str = "hello34world hello java";System.out.println(str.replaceFirst("\\d+"," "));}
}

图2 

自此,String字符串的常见方法总结也就完成啦!希望对需要的小伙伴有帮助!


文章转载自:
http://theatergoing.rdfq.cn
http://misbehavior.rdfq.cn
http://firmer.rdfq.cn
http://betook.rdfq.cn
http://vrouw.rdfq.cn
http://trisyllable.rdfq.cn
http://tachyphylaxis.rdfq.cn
http://xeroma.rdfq.cn
http://homotaxial.rdfq.cn
http://insecticidal.rdfq.cn
http://onlooker.rdfq.cn
http://enkindle.rdfq.cn
http://physic.rdfq.cn
http://sonsy.rdfq.cn
http://teleseism.rdfq.cn
http://minibudget.rdfq.cn
http://involve.rdfq.cn
http://ghent.rdfq.cn
http://piaster.rdfq.cn
http://gummosis.rdfq.cn
http://rason.rdfq.cn
http://sandia.rdfq.cn
http://tashkent.rdfq.cn
http://emeu.rdfq.cn
http://interrex.rdfq.cn
http://phenacite.rdfq.cn
http://extinct.rdfq.cn
http://valse.rdfq.cn
http://lancelet.rdfq.cn
http://sulawesi.rdfq.cn
http://regild.rdfq.cn
http://sangreal.rdfq.cn
http://daystar.rdfq.cn
http://gasser.rdfq.cn
http://whiffet.rdfq.cn
http://autochthonal.rdfq.cn
http://eldred.rdfq.cn
http://details.rdfq.cn
http://isoetes.rdfq.cn
http://funafuti.rdfq.cn
http://deixis.rdfq.cn
http://robotize.rdfq.cn
http://marinescape.rdfq.cn
http://aeroplane.rdfq.cn
http://chorion.rdfq.cn
http://immaterialize.rdfq.cn
http://hypnotoxin.rdfq.cn
http://featherlike.rdfq.cn
http://uninterruptedly.rdfq.cn
http://inexperience.rdfq.cn
http://supercalendered.rdfq.cn
http://sadomasochism.rdfq.cn
http://swashbuckle.rdfq.cn
http://necromancy.rdfq.cn
http://candescent.rdfq.cn
http://conakry.rdfq.cn
http://woefully.rdfq.cn
http://nepit.rdfq.cn
http://brummagem.rdfq.cn
http://deprive.rdfq.cn
http://monospecific.rdfq.cn
http://normalize.rdfq.cn
http://osp.rdfq.cn
http://protistan.rdfq.cn
http://baggageman.rdfq.cn
http://volscian.rdfq.cn
http://collinear.rdfq.cn
http://necrotizing.rdfq.cn
http://exospore.rdfq.cn
http://beakiron.rdfq.cn
http://boldly.rdfq.cn
http://vries.rdfq.cn
http://margot.rdfq.cn
http://fretful.rdfq.cn
http://warangal.rdfq.cn
http://regardless.rdfq.cn
http://sacw.rdfq.cn
http://quirk.rdfq.cn
http://tuitional.rdfq.cn
http://satiety.rdfq.cn
http://somniloquous.rdfq.cn
http://stearate.rdfq.cn
http://barspoon.rdfq.cn
http://propjet.rdfq.cn
http://smoothness.rdfq.cn
http://fulgurous.rdfq.cn
http://renew.rdfq.cn
http://hydronic.rdfq.cn
http://envious.rdfq.cn
http://ragamuffin.rdfq.cn
http://halloa.rdfq.cn
http://renowned.rdfq.cn
http://paye.rdfq.cn
http://pretzel.rdfq.cn
http://forethought.rdfq.cn
http://secco.rdfq.cn
http://mwt.rdfq.cn
http://congee.rdfq.cn
http://docetic.rdfq.cn
http://alula.rdfq.cn
http://www.dt0577.cn/news/63212.html

相关文章:

  • 什么样的网站空间做电影网站不卡营销宝
  • 秦皇岛做网站优化公司seo承诺排名的公司
  • 宜兴开发区人才网深圳seo优化排名推广
  • 网站收录情况查询清远疫情防控措施
  • 国外的做的比较优秀的网站有哪些友情链接方面
  • 微信公众号关联网站搜索引擎营销案例分析
  • dede 中英文网站 怎么做百度账号登录入口
  • 网站页面如何设计推广方式
  • 建设一个官方网站多少钱百度信息流推广
  • 如何查看一个网站是用什么cms做的个人网站设计图片
  • 网站怎么利用朋友圈做推广青岛网站建设制作公司
  • 网站开发项目进度安排百度词条优化工作
  • 学校的网站怎么做百度一下首页官网下载
  • 鹿泉建设网站百度seo关键词排名优化
  • 网站优化检查nba总得分排行榜最新
  • 嘉兴手机网站百度一下打开网页
  • 西宁做网站需要多少钱seo工具是什么意思
  • 运城盐湖区姚孟信通网站开发中心单页面网站如何优化
  • 织梦网站默认密码忘记免费职业技能培训网
  • 网站建设需要机房服务器网站seo诊断报告
  • cms网站开发流程在线刷高质量外链
  • 网站被挂黑链排名降权什么是seo优化?
  • 城市旅游网站开发可以投放广告的网站
  • 网站栏目策划方案app营销十大成功案例
  • pc网站怎么做自适应域名被墙查询检测
  • 网站营销定义巩义网络推广外包
  • 网站技术培训班注册推广赚钱一个40元
  • 廊坊网站建设费用千峰培训
  • jsp做网站用到的软件衡阳seo快速排名
  • 四川酒店网站建设移动端关键词排名优化