当前位置:网站首页>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(','));
边栏推荐
- Overload global and member new/delete
- Dynamic global memory allocation and operation in CUDA
- The default Google browser cannot open the link (clicking the hyperlink does not respond)
- apt命令报证书错误 Certificate verification failed: The certificate is NOT trusted
- 20210306转载如何使TextEdit有背景图片
- Sentinel rules persist to Nacos
- (the 100th blog) written at the end of the second year of doctor's degree -20200818
- (第一百篇BLOG)写于博士二年级结束-20200818
- The table component specifies the concatenation parallel method
- Nodejs - Express middleware modification header: typeerror [err_invalid_char]: invalid character in header content
猜你喜欢
20201002 vs 2019 qt5.14 developed program packaging
Apt command reports certificate error certificate verification failed: the certificate is not trusted
Latex 编译报错 I found no \bibstyle & \bibdata & \citation command
Linux MySQL 5.6.51 Community Generic 安装教程
qq邮箱接收不到jenkins构建后使用email extension 发送的邮件(timestamp 或 auth.......)
Implement strstr() II
QQ email cannot receive the email sent by Jenkins using email extension after construction (timestamp or auth...)
Detailed definition of tensorrt data format
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
FE - 微信小程序 - 蓝牙 BLE 开发调研与使用
随机推荐
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
看完有用的blog
Linux MySQL 5.6.51 community generic installation tutorial
sqli-labs通关汇总-page3
CVE-2015-1635(MS15-034 )远程代码执行漏洞复现
Latex compilation error I found no \bibstyle &\bibdata &\citation command
JS modification element attribute flipping commonly used in selenium's Web Automation
20210306 reprint how to make TextEdit have background pictures
Usage of map and foreach in JS
Self study table Au
Redis -- cache breakdown, penetration, avalanche
js删除字符串的最后一个字符
Deployment API_ automation_ Problems encountered during test
Sentinel Alibaba open source traffic protection component
Asynchronous data copy in CUDA
由於不正常斷電導致的unexpected inconsistency;RUN fsck MANUALLY問題已解决
Explanation and application of annotation and reflection
Vector types and variables built in CUDA
selenium+msedgedriver+edge浏览器安装驱动的坑
AWD学习