Re: Delete Last Item in A List



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/


.



Relevant Pages

  • Cannot right-click "Save Target as"
    ... the "save target as..." ... no matter what. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Sibelius 5 - Gibson/LSO
    ... worked in a recording company and radio station (at least, ... it doesn't matter because you ... Your ignoring is even more boring. ... But you keep replying and ...
    (rec.music.classical.recordings)
  • Re: Sibelius 5 - Gibson/LSO
    ... Nobody has come even close to this recording, ... designed to fool and impress idiots like you. ... it doesn't matter because you ... But you keep replying and ...
    (rec.music.classical.recordings)
  • Re: Sibelius 5 - Gibson/LSO
    ... Nobody has come even close to this recording, ... it doesn't matter because you ... But you keep replying and ... I know there is some really sad story behind all this over there where ...
    (rec.music.classical.recordings)
  • Re: Sibelius 5 - Gibson/LSO
    ... worked in a recording company and radio station (at least, ... it doesn't matter because you ... all the new messages by you, not just replying to almost anything I ... day in what time zone. ...
    (rec.music.classical.recordings)