当前位置:网站首页>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
边栏推荐
- Latex warning: citation "*****" on page y undefined on input line*
- virtualenv和pipenv安装
- Latex error: the font size command \normalsize is not defined problem solved
- There is no way to drag the win10 desktop icon (you can select it, open it, delete it, create it, etc., but you can't drag it)
- FE - Weex 使用简单封装数据加载插件为全局加载方法
- 【文献阅读与想法笔记13】 Unprocessing Images for Learned Raw Denoising
- Atcoder beginer contest 253 F - operations on a matrix / / tree array
- 微信小程序基础
- Code execution sequence with and without resolve in promise
- flex九宫格布局
猜你喜欢
随机推荐
Code execution sequence with and without resolve in promise
The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
[daily question 1] write a function to judge whether a string is the string after the rotation of another string.
微信小程序基础
Fe - weex uses a simple encapsulated data loading plug-in as the global loading method
sprintf_s的使用方法
Latex compilation error I found no \bibstyle &\bibdata &\citation command
Explanation and application of annotation and reflection
The use of regular expressions in JS
unittest.TextTestRunner不生成txt测试报告
CTF three count
AWD学习
Kotlin - verify whether the time format is yyyy MM DD hh:mm:ss
Browser scrolling for more implementations
Queue (linear structure)
Log - 7 - record a major error in missing documents (A4 paper)
Utilisation de la carte et de foreach dans JS
FE - 微信小程序 - 蓝牙 BLE 开发调研与使用
VSCODE 安装LATEX环境,参数配置,常见问题解决
Linux MySQL 5.6.51 community generic installation tutorial