首页 > 其他 > 详细

LeetCode--String刷题总结

时间:2018-05-20 10:31:06      阅读:169      评论:0      收藏:0      [点我收藏+]

对于不是对于单个字符进行操作,而是对单词进行操作时,可以选择一些库函数

 

常用的有:

1. str.split(" ");  按照空格将字符串进行划分,得到字符串数组

2. str.substring(i, j); 得到字符串的子串 [ i, j )

3. str.contains("s1"); str中是否包含 s1字符串

4. str.charAt(7); str在7位置上的char型字符

5. str.trim(); 去除str两侧的空格

应用:山羊拉丁文Goat Latin

*LeetCode--Goat Latin

LeetCode--String刷题总结

原文:https://www.cnblogs.com/SkyeAngel/p/9062478.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!