• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4193
  • Last Modified:

VB Implode function?

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
DrDamnit
Asked:
DrDamnit
  • 3
2 Solutions
 
bkthompson2112Commented:
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
 
ColosseoCommented:
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
 
DrDamnitAuthor Commented:
First in time, is first in right. Thanks to both of you!
0
 
bkthompson2112Commented:
You're welcome.  Thanks for the 'A'
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now