博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
String substring()方法
阅读量:2502 次
发布时间:2019-05-11

本文共 613 字,大约阅读时间需要 2 分钟。

substring() returns a portion of a string and it’s similar to , with some key differences.

substring()返回字符串的一部分,它类似于 ,但有一些关键区别。

If any parameter is negative, it is converted to 0. If any parameter is higher than the string length, it is converted to the length of the string.

如果任何参数为负,则将其转换为0 。 如果任何参数大于字符串长度,则将其转换为字符串的长度。

So:

所以:

'This is my car'.substring(5) //'is my car''This is my car'.substring(5, 10) //'is my''This is my car'.substring(5, 200) //'is my car''This is my car'.substring(-6) //'This is my car''This is my car'.substring(-6, 2) //'Th''This is my car'.substring(-6, 200) //'This is my car'

翻译自:

转载地址:http://jlqgb.baihongyu.com/

你可能感兴趣的文章
工作中常见问题
查看>>
JAVA 从一个List里删除包含另一个List的数据
查看>>
外国的月亮比较圆吗?外籍团队工作有感
查看>>
CentOS 关闭烦人的屏保
查看>>
分布式系统事务一致性解决方案
查看>>
ShuffleNet总结
查看>>
前后台验证字符串长度
查看>>
《算法导论 - 思考题》7-1 Hoare划分的正确性
查看>>
IOS 简单的动画自定义方法(旋转、移动、闪烁等)
查看>>
图像处理笔记(十二)
查看>>
Chapter 3 Phenomenon——9
查看>>
win64 Python下安装PIL出错解决2.7版本 (3.6版本可以使用)
查看>>
获取各种类型的节点
查看>>
表达式求值-201308081712.txt
查看>>
centos中安装tomcat6
查看>>
从Vue.js窥探前端行业
查看>>
学习进度
查看>>
poj3368 RMQ
查看>>
“此人不存在”
查看>>
github.com加速节点
查看>>