Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript functions

Status
Not open for further replies.

crystalized

Programmer
Joined
Jul 10, 2000
Messages
390
Location
CA
Hi all

Is there a javascript function that goes through a string and replaces instances of some substring with another string. I know in VBScript there is the Replace function that does this.

If anyone knows of a function (and especially the syntax for it) or where I can find a function like this I would greatly appreciate the pointer.

Thanks in advance.
 
You can do a replace but you gotta use a regular expression.

You can see the syntax of the command at this website:

p.s. that is the Netscape Javascript 1.3 documentation hosted on my machine at home using my DSL connection so don't expect anything too fancy :-).
 
As it turns out I was able to handle what I needed by altering the stored procedure that was providing the data.

What I did was shave off the first 2 characters of each of the words in the resultset (which are the -- I wanted to replace)

Then since I am using Visual Interdev within the Grid DTC you can format output using javascript. In this case I just had to concatenate the two spaces onto the front of the descriptions in the resultset. It was there in the formating of the resultset that I wanted to use the replace function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top