jQuery中的RTrim [英] RTrim in jQuery

查看:52
本文介绍了jQuery中的RTrim的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对jQuery的修饰有疑问.我在jQuery中有这样的字符串:

I am having a problem with jQuery's trim. I have a string such at in jQuery:

var string1;
string1 = "one~two~";

如何修剪拖尾波浪线?

推荐答案

.trim()的jQuery方法是指空白..

The .trim() method of jQuery refers to whitespace ..

说明:删除字符串开头和结尾的空格.

Description: Remove the whitespace from the beginning and end of a string.


您需要

string1.replace(/~+$/,'');

这将删除所有尾随的.

所以 one〜two ~~~~~ 也将变成 one〜two

这篇关于jQuery中的RTrim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆