Solved

asp array  - replace string in array

Posted on 2007-11-29
3
2,402 Views
Last Modified: 2008-06-04
I have an array in asp

can someone help me to search for a string in the array that is an exact match (meaning if i search cat it will return cat but not categories) and replace it with another string i specify.
0
Comment
Question by:bottomlinemg
3 Comments
 
LVL 25

Expert Comment

by:kevp75
ID: 20373550
you should be able to get away with using the instr function.  I would do a binary compare though instead of a textual compare...

http://www.w3schools.com/vbscript/func_instr.asp
0
 
LVL 1

Expert Comment

by:esthera
ID: 20373793
can someone help me write a function to do this?
0
 
LVL 28

Accepted Solution

by:
sybe earned 250 total points
ID: 20373795

   
For i = 0 To Ubound(MyArray)
   If MyArray(i) = "cat" Then MyArray(i) = "another string"
Next 

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question