const obj="中国,美国,英国,法国,德国," //方法一: const result1 = obj.substring(0, obj.lastIndexOf(',')); //方法二: const result2 = (obj.substring(obj.length - 1) == ',') ? obj.substring(0, obj.length - 1) : obj; //方法三: const result3 = obj.substring(0,obj.length-1); //方法四: const reg = /,$/gi; const result4 = obj.replace(reg,""); //结果输出: console.log('方法1:',result1) console.log('方法2:',result2) console.log('方法3:',result3) console.log('方法4:',result4)
上面是“js去除字符串最后一个特殊符号(如:逗号、顿号等)”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_2008.html
workflows工作流
庭院,彩色玫瑰,云雾笼罩comfyui工作流
完整海报生成comfyui工作流
一幅生动而古怪的时尚鸭子插图ComfyUI工作流
一只在星系中漂浮宇宙生物ComfyUI工作流
在地铁站里一个迷茫的非主流姑娘
一个外国人在吹奏萨克斯ComfyUI工作流
一辆老式灵车在黑暗中从雾中出现ComfyUI工作流
一颗柔和的水晶金字塔ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!