« Return to Thread: Re: [OT] Jquery Remove Trailing "&" From String

Re: [OT] Jquery Remove Trailing "&" From String

by Brad Lindsay-2 :: Rate this Message:

Reply to Author | View in Thread


On Jul 6, 2009, at 2:30 PM, Brad Lindsay wrote:

> On Jul 6, 2009, at 2:23 PM, Israel Thompson wrote:
>> Sorry, for posting here.. something seems to be wrong with my post  
>> being
>> accepted in the Jquery list...
>>
>> What's the easiest way to remove the trailing "&" from a string in  
>> Jquery?
>
> If the string is a JavaScript variable named str, this code should  
> work:
>
> str.replace(/&$/,"");
>
> -Brad


If you want to replace all trailing "&", for example "test&&&&"  
becomes "test", edit the regular expression so that the code looks  
like this:
        str.replace(/&+$/, "");

-Brad

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


 « Return to Thread: Re: [OT] Jquery Remove Trailing "&" From String