当前位置:网站首页>JS delete the last character of the string
JS delete the last character of the string
2022-07-02 06:50:00 【xuefankang】
var str = "abc,def,ghi,";
1.substr() Method to extract from a string start The specified number of characters from which the subscript begins .
str = str.substr(0, str.length - 1);
2.substring() Method is used to extract characters that are mediated between two specified subscripts .
str = str.substring(0, str.length - 1);
3.lastIndexOf() Method returns the last occurrence of a specified string value , Search from back to front in a specified position in a string
str = str.substring(0, str.lastIndexOf(','));
边栏推荐
- Sentinel Alibaba open source traffic protection component
- Linux MySQL 5.6.51 Community Generic 安装教程
- Flask migrate cannot detect db String() equal length change
- Implement strstr() II
- selenium备忘录:selenium\webdriver\remote\remote_connection.py:374: ResourceWarning: unclosed<xxxx>解决办法
- Error "list" object is not callable in Web automatic switching window
- VSCODE 安装LATEX环境,参数配置,常见问题解决
- 工具种草福利帖
- Sentry搭建和使用
- FE - 微信小程序 - 蓝牙 BLE 开发调研与使用
猜你喜欢
Recursion (maze problem, Queen 8 problem)
Latex 报错 LaTeX Error: The font size command \normalsize is not defined问题解决
Présence d'une panne de courant anormale; Problème de gestion de la fsck d'exécution résolu
CTF web practice competition
查询GPU时无进程运行,但是显存却被占用了
蚂蚁集团g6初探
默认google浏览器打不开链接(点击超链接没有反应)
CVE-2015-1635(MS15-034 )远程代码执行漏洞复现
ctf-web之练习赛
Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
随机推荐
Loops in tensorrt
Self cultivation of programmers - Reflection on job hunting
js判断数组中对象是否存在某个值
ctf三计
Win10: add or delete boot items, and add user-defined boot files to boot items
Utilisation de la carte et de foreach dans JS
Latex compiles Chinese in vscode and solves the problem of using Chinese path
VSCODE 安装LATEX环境,参数配置,常见问题解决
Warp matrix functions in CUDA
Common function writing method and set get writing method for calculating attributes
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
unittest.TextTestRunner不生成txt测试报告
Kali latest update Guide
Log - 7 - record a major error in missing documents (A4 paper)
js删除字符串的最后一位
Warp shuffle in CUDA
js中对于返回Promise对象的语句如何try catch
20210306 reprint how to make TextEdit have background pictures
automation - Jenkins pipline 执行 nodejs 命令时,提示 node: command not found
Redis -- cache breakdown, penetration, avalanche