Re: Delete Last Item in A List
- From: buddhatown@xxxxxxxxx
- Date: Mon, 12 Nov 2007 14:44:25 -0000
Wow. I am embarrassed. Code works fine now. The | were actually
l's. I dont recall ever seeing something delimited with an l...but I
suppose it could make sense since its a line coord. Anyway, thanks to
everyone for the help. My appreciated.
Jason
On Nov 10, 11:19 pm, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
buddhat...@xxxxxxxxx said the following on 11/10/2007 10:22 PM:
Argh. I omitted something in that original string that I didnt think
would matter, but apparently it does...becasue I cant get any of those
examples to work (but thanks so much for the help)
You also forgot to quote what you are replying to.
The string actually looks like this:
var drawPathList = 'm 23,34||45,67||456,678||43,78';
note the m in the beginning and no || at the end.
The m and || don't matter to split. If the solution posted by Evertjan
isn't "working" then something else in your code is causing the problem
Post a URL to a sample page.
But, there is a solution without using arrays at all.
var oldList = 'm 23,34||45,67||456,678||43,78';
var newList = oldList.substring(0,oldList.lastIndexOf('||'));
alert(newList);
gives
m 23,34||45,67||456,678
Which is what you wanted, isn't it?
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
.
- Follow-Ups:
- Re: Delete Last Item in A List
- From: Evertjan.
- Re: Delete Last Item in A List
- References:
- Delete Last Item in A List
- From: buddhatown
- Re: Delete Last Item in A List
- From: Bart Van der Donck
- Re: Delete Last Item in A List
- From: Evertjan.
- Re: Delete Last Item in A List
- From: buddhatown
- Re: Delete Last Item in A List
- From: Randy Webb
- Delete Last Item in A List
- Prev by Date: Re: JavaScript to validate User input
- Next by Date: Re: really simple form completion library/widget?
- Previous by thread: Re: Delete Last Item in A List
- Next by thread: Re: Delete Last Item in A List
- Index(es):
Relevant Pages
|