Solved

VB Implode function?

Posted on 2004-08-26
5
4,031 Views
Last Modified: 2008-01-16
PHP has an implode function with concatenates an array with a given delimeter to a string. This is the exact opposite of the Split() function in VB. Does VB have a similar function?

Example:
array[1] = Bob
array[2] = Fred
array[3] = Mary

implode (array, ",") returns: Bob,Fred,Mary

-Curious Dr. Damnit
0
Comment
Question by:DrDamnit
  • 3
5 Comments
 
LVL 6

Accepted Solution

by:
bkthompson2112 earned 400 total points
ID: 11906976
Hi DrDamnit,

use the Join function

from MSDN:

Join(sourcearray[, delimiter])

The Join function syntax has these named arguments:

sourcearray Required. One-dimensional array containing substrings to be joined.
delimiter Optional. String character used to separate the substrings in the returned string. If omitted, the space character (" ") is used. If delimiter is a zero-length string (""), all items in the list are concatenated with no delimiters.

bkt
0
 
LVL 6

Expert Comment

by:bkthompson2112
ID: 11906984
0
 
LVL 15

Assisted Solution

by:Colosseo
Colosseo earned 100 total points
ID: 11906986
Hi Dr

the implode is the same as join in vb

so

arrnames(0) = "Bob"
arrnames(1) = "Fred"
arrnames(2) = "Mary"

join(arrnames,",")

would return

Bob,Fred,Mary

HTH

Scott
0
 
LVL 32

Author Comment

by:DrDamnit
ID: 11917269
First in time, is first in right. Thanks to both of you!
0
 
LVL 6

Expert Comment

by:bkthompson2112
ID: 11917950
You're welcome.  Thanks for the 'A'
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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