Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Locate String Within a String


Message #1 by rg1@h... on Thu, 12 Apr 2001 19:39:28
Yes, that's it! Thanks.

-----Original Message-----
From: Albetski, Allan [mailto:aalbetski@t...]
Sent: Friday, April 13, 2001 5:50 AM
To: javascript
Subject: [javascript] RE: Locate String Within a String


Is this was you are looking for:

var myStr = new String("12345 / ritag / 54321")
var lFirstSlash = myStr.indexOf("/") + 1
document.write(myStr.slice(lFirstSlash))


-----Original Message-----
From: rg1@h... [mailto:rg1@h...]
Sent: Thursday, April 12, 2001 3:39 PM
To: javascript
Subject: [javascript] Locate String Within a String


Hi.

I have a JavaScript function that needs to locate everything to the right 
of the first "/" within a string.

e.g. myStr = "12345 / ritag / 54321".

I need to extract "ritag / 54321"

Could somebody please give me an example of code to accomplish this?

TIA.

Rita


  Return to Index