Array function lastIndexOf


    Jul 12 2006 | 4:53 am

    • Jul 12 2006 | 7:22 am
      Paul,
      On 12 juil. 06, at 06:53, Paul Hertz wrote:
      > I have been attempting to use the array function lastIndexOf, which is
      > documented as a standard function belonging to the Array class:
      >
      > http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:
      > Global_Objects:Array:lastIndexOf
      I read on this webpage that lastIndexOf has been implemented in
      JavaScript 1.6 (although the doc is for 1.5!) but Max runs a JavaScript
      1.5 version.
      There is no mention of this method for the Array class in my 1.5
      documentation (the method exists only for String). I'm afraid you'll
      have to implement it yourself!
      _____________________________
      Patrick Delges
      Centre de Recherches et de Formation Musicales de Wallonie asbl
    • Jul 12 2006 | 7:41 am
      >> I have been attempting to use the array function lastIndexOf,
      >> which is
      >> documented as a standard function belonging to the Array class:
      >>
      >> http://developer.mozilla.org/en/docs/
      >> Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf
      >
      > I read on this webpage that lastIndexOf has been implemented in
      > JavaScript 1.6 (although the doc is for 1.5!) but Max runs a
      > JavaScript 1.5 version.
      > There is no mention of this method for the Array class in my 1.5
      > documentation (the method exists only for String). I'm afraid
      > you'll have to implement it yourself!
      try:
      outlet(0, s1.toString().lastIndexOf("goo"));
      a little clunky, but should do it.
      vb
    • Jul 12 2006 | 1:28 pm
      Thanks, Patrick,
      I concluded the same almost as soon as I sent the message--a closer
      look at the documentation revealed that indexOf and lastIndexOf are
      1.6 features.
      Sending a message to a list has a way of making solutions suddenly
      leap out at you. It must be a psycho-logical phenomenon akin to flow.
      -- Paul
      On 7/12/06, Patrick Delges wrote:
      > Paul,
      >
      > On 12 juil. 06, at 06:53, Paul Hertz wrote:
      >
      > > I have been attempting to use the array function lastIndexOf, which is
      > > documented as a standard function belonging to the Array class:
      > >
      > > http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:
      > > Global_Objects:Array:lastIndexOf
      >
      > I read on this webpage that lastIndexOf has been implemented in
      > JavaScript 1.6 (although the doc is for 1.5!) but Max runs a JavaScript
      > 1.5 version.
      > There is no mention of this method for the Array class in my 1.5
      > documentation (the method exists only for String). I'm afraid you'll
      > have to implement it yourself!
      >
      > _____________________________
      > Patrick Delges
      >
      > Centre de Recherches et de Formation Musicales de Wallonie asbl
      > http://users.skynet.be/crfmw/max
      >
      >
      --
      ----- |(*,+,#,=)(#,=,*,+)(=,#,+,*)(+,*,=,#)| -----
    • Jul 12 2006 | 1:37 pm
      Well, that gets me the index of a char in a string, not the array
      index. As Patrick says, I'd have to roll my own to get the array
      index, which AFAIK implies stepping through the array. If I reeeally
      want to insist, I can add the function to the Array prototype, which I
      think would make it global within a single session's shared JS global
      "world."
      The richer vocabulary of Java is a great comfort in these situations.
      -- Paul
      On 7/12/06, vb wrote:
      > >> I have been attempting to use the array function lastIndexOf,
      > >> which is
      > >> documented as a standard function belonging to the Array class:
      > >>
      > >> http://developer.mozilla.org/en/docs/
      > >> Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf
      > >
      > > I read on this webpage that lastIndexOf has been implemented in
      > > JavaScript 1.6 (although the doc is for 1.5!) but Max runs a
      > > JavaScript 1.5 version.
      > > There is no mention of this method for the Array class in my 1.5
      > > documentation (the method exists only for String). I'm afraid
      > > you'll have to implement it yourself!
      >
      > try:
      >
      > outlet(0, s1.toString().lastIndexOf("goo"));
      >
      > a little clunky, but should do it.
      > vb
      >
      >
      >
      >
      --
      ----- |(*,+,#,=)(#,=,*,+)(=,#,+,*)(+,*,=,#)| -----
    • Jul 13 2006 | 9:57 am
      On 12 Jul 2006, at 15:37, Paul Hertz wrote:
      > Well, that gets me the index of a char in a string, not the array
      > index.
      ok, now i understand what you actually want.
      sorry for the confusion.
      vb.