Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

replace a var in an array

Posted on 2004-08-20
3
Medium Priority
?
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Colosseo earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

661 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