Solved

replace a var in an array

Posted on 2004-08-20
3
183 Views
Last Modified: 2010-05-02
im looking to replace a word in a array list of something like "#4,#hello,#yellow,#Den,#Charlie,#wow,#menu"

and replace #4 with #4:20

my array list is housed in arglist(1) allready

how do i do that please

thanks ever so much
0
Comment
Question by:Johnny
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Colosseo earned 500 total points
ID: 11856456
Hi Pern

I hope this is what you are after

' value to find
str_Search = "#4"

' value to replace search string with
str_Replace = "#4:20"

' populate array
arglist = Array("#4", "#hello", "#yellow", "#Den", "#Charlie", "#wow", "#menu")

' for each item in the array
For i = LBound(arglist) To UBound(arglist)
  ' if the search string is found then replace it
  If arglist(i) = str_Search Then arglist(i) = str_Replace
Next

Regards

Scott
0
 

Author Comment

by:Johnny
ID: 11856543
one million percent perfect thx  Colosseo

heres your points
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 11856557
Hi Pern

one million percent perfect sounds good too me :)

Glad your happy and thanks for the grade!

Scott
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now