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

View: New views
4 Messages — Rating Filter:   Alert me  

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

by Jason Huck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That's more of a general javascript question. It should be something like this:

var mystring = 'foooobaaaaarrrrr&';
mystring = mystring.substr(0, mystring.length - 2);

- jason



On Mon, Jul 6, 2009 at 2:23 PM, Israel
Thompson<thompson.israel@...> 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?
>
> Thanks,
>
> Israel
> --
> View this message in context: http://www.nabble.com/-OT--Jquery-Remove-Trailing-%22-%22-From-String-tp24360470p24360470.html
> Sent from the Lasso - Talk mailing list archive at Nabble.com.
>
>
> --
> 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/
>
>
>



--
tagSwap.net :: Open Source Lasso Code
<http://tagSwap.net/>

--
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/



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

by Israel Thompson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, that works too!

Israel

Jason Huck wrote:
That's more of a general javascript question. It should be something like this:

var mystring = 'foooobaaaaarrrrr&';
mystring = mystring.substr(0, mystring.length - 2);

- jason

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

by Brad Lindsay-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jul 6, 2009, at 2:37 PM, Jason Huck wrote:
> That's more of a general javascript question. It should be something  
> like this:
>
> var mystring = 'foooobaaaaarrrrr&';
> mystring = mystring.substr(0, mystring.length - 2);

As an FYI, this will always remove the last character of the string  
while my solutions only remove the character if it's an ampersand.

-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/



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

by Jason Huck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Right, you could easily make it conditional, but the regex approach is simpler.

- jason



On Mon, Jul 6, 2009 at 3:02 PM, Brad Lindsay<blindsay@...> wrote:

> On Jul 6, 2009, at 2:37 PM, Jason Huck wrote:
>>
>> That's more of a general javascript question. It should be something like
>> this:
>>
>> var mystring = 'foooobaaaaarrrrr&';
>> mystring = mystring.substr(0, mystring.length - 2);
>
> As an FYI, this will always remove the last character of the string while my
> solutions only remove the character if it's an ampersand.
>
> -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/
>
>
>



--
tagSwap.net :: Open Source Lasso Code
<http://tagSwap.net/>

--
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/