PDA

View Full Version : Help! Substring thing!


lightning_html
02.06.2001, 13:40
Hi everyone again!
I am in need of a script. I am after a script which can take the information from a substring (info after a ? in a url), then if it finds any underscores, then it converts that underscore into a space. Then when it has done this, writes the result to the webpage, using the document.write thingy.

I already know how to capture, and write the info to the webpage, but I don't know how to convert.

I'd love to know a solution to this.

Adam
<img src=icon_smile_clown.gif border=0 align=middle>




Edited by - lightning_html on 06/03/2001 05:33:48

manswide
03.06.2001, 11:05
var Substring="your_url_substring"

while(!Substring.indexOf("_"))Substring.replace("_","*")

lightning_html
03.06.2001, 15:22
<BLOCKQUOTE id=quote><font size=1 face="Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
var Substring="your_url_substring"

while(!Substring.indexOf("_"))Substring.replace("_","*")


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Arial, Helvetica" size=2 id=quote>

Thanks for that,
but how do I implement that? I need to write it to a webpage, but when I give that while method a name so that I can write it, it wont work.

Thanks anyway!
Adam

manswide
03.06.2001, 15:28
Sorry. This is the correct syntax:

Substring="what_ever_..."
while(Substring.indexOf("_")!=-1)Substring=Substring.replace("_","*")
document.write(Substring)



Edited by - manswide on 06/03/2001 14:29:52

lightning_html
03.06.2001, 15:40
Cheers, it worked like a charm! The world needs more people like you, and bratta!

I needed this script as when I insert a html document into a template, it reads the page filename, then copies it into the page as a header. Anyway thankyou!

Adam