当前位置:网站首页>JS delete the last bit of the string
JS delete the last bit of the string
2022-07-02 06:50:00 【xuefankang】
1.substr() Method
var str = "abc,def,ghi,";
str = str.substr(0, str.length - 1);
console.log(str) // return abc,def,ghi
2.substring() Method
var str = "abc,def,ghi,";
str = str.substring(0, str.length - 1);
console.log(str) // return abc,def,ghi
3.lastIndexOf() Method
var str = "abc,def,ghi,";
str = str.substring(0, str.lastIndexOf(','));
console.log(str) // return abc,def,ghi
边栏推荐
- qq邮箱接收不到jenkins构建后使用email extension 发送的邮件(timestamp 或 auth.......)
- (the 100th blog) written at the end of the second year of doctor's degree -20200818
- 2020-9-23 QT的定时器Qtimer类的使用。
- 记录一次RDS故障排除--RDS容量徒增
- flex九宫格布局
- Sentry construction and use
- 由於不正常斷電導致的unexpected inconsistency;RUN fsck MANUALLY問題已解决
- Functions of tensorrt
- Self study table Au
- How to try catch statements that return promise objects in JS
猜你喜欢
In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy
unittest.TextTestRunner不生成txt测试报告
Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
Sentinel Alibaba open source traffic protection component
pytest(2) mark功能
AWD learning
Latex compilation error I found no \bibstyle &\bibdata &\citation command
table 组件指定列合并行方法
Implement strstr() II
Blog directory of zzq -- updated on 20210601
随机推荐
Fe - weex uses a simple encapsulated data loading plug-in as the global loading method
20210306 reprint how to make TextEdit have background pictures
CUDA user object
selenium+msedgedriver+edge浏览器安装驱动的坑
浏览器滚动加载更多实现
Usage of map and foreach in JS
A preliminary study on ant group G6
AWD学习
Win10: add or delete boot items, and add user-defined boot files to boot items
Pytest (1) case collection rules
2020-9-23 use of QT timer qtimer class.
[self cultivation of programmers] - Reflection on job hunting Part II
Atcoder beginer contest 253 F - operations on a matrix / / tree array
Sentinel rules persist to Nacos
Linux MySQL 5.6.51 Community Generic 安装教程
How to try catch statements that return promise objects in JS
由於不正常斷電導致的unexpected inconsistency;RUN fsck MANUALLY問題已解决
Browser scrolling for more implementations
ts和js区别
Stack (linear structure)