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

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

字符串的slice方法

Return a new string from the part of the string included between the begin and end positions.

beginend位置之间包含的字符串部分返回一个新字符串。

The original string is not mutated.

原始字符串未更改。

end is optional.

end是可选的。

'This is my car'.slice(5) //is my car'This is my car'.slice(5, 10) //is my

If you set a negative first parameter, the start index starts from the end, and the second parameter must be negative as well, always counting from the end:

如果将第一个参数设置为负,则起始索引从末尾开始,第二个参数也必须为负,始终从末尾开始计数:

'This is my car'.slice(-6) //my car'This is my car'.slice(-6, -4) //my

翻译自:

字符串的slice方法

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

你可能感兴趣的文章
HDU 1087 Super Jumping! Jumping! Jumping!
查看>>
0007_初始模块和字节码
查看>>
[效率提升]如何管理好你的电脑文件
查看>>
C++实验二
查看>>
Sultan's Dowry Problem - 苏丹新娘问题
查看>>
SharePoint2010 富文本框添加图片功能的扩展
查看>>
零零碎碎的知识
查看>>
UNIX基础--用户和基本账户管理
查看>>
设计模式
查看>>
5.0以上机器XPOSED框架安装流程
查看>>
静态方法与非静态方法
查看>>
[转]iOS进阶路线以及进阶书籍
查看>>
期货监管机构,国际著名。
查看>>
vim编程技巧
查看>>
Activator.CreateInstance 方法 (Type) 的用法
查看>>
我的将军啊
查看>>
openstack mariadb 容器无法启动问题解决方法
查看>>
实例的初始化过程: new 对象
查看>>
10.02 一个简单的串口的初始化程序
查看>>
Ant学习笔记
查看>>