in

vbCity Blogs

New (temp) place for vbCity Blogs

Mike McIntyre's .NET Journal

Delimit Strings with the Visual Basic Join Function

VIsual Basic contains some useful functions not available in the .NET class library.

This post is about one of those functions, the Join(string array,string delimiter) function.

The Join function concatenates an array of strings into a delimited string using a specified delimiter.

Here is a method that includes the Join function:

    Private Function GetDelimitedString(ByVal strings As String(), ByVal delimiter As String) As String

        Return Join(strings, delimiter)

    End Function

Here is an example that demonstrates using the method:

Dim strings As String() = {"red", "green", "blue"}

Console.WriteLine(GetDelimitedString(strings, ":"))

Result:      red:green:blue

Only published comments... Dec 24 2008, 10:39 AM by Mike McIntyre
Filed under: , ,

Comments

 

Rick Ratayczak said:

You can do the same with String.Join(strings(), ":")

Opposite of:

strings() = str.Split(":")

December 29, 2008 10:17 AM
 

Mike McIntyre said:

Yes you can Rick.  Thanks!

December 31, 2008 3:46 PM

About Mike McIntyre

I  am a programmer, developer, and system architect with 29+years experience including state-of-the-art application development frameworks and languages including Visual Studio 2008, .NET 3.5, C#, and Visual Basic.

I am a mentor, trainer, and coach in the Microsoft .NET technical community. DevCity is my favorite community site. You can find examples of my involvement with DevCity in the site articles, newsletter articles, and my posts in the forum.

Since 2002 I have hosted a .NET site at http://www.getdotnetcode.com, a place with free and inexpensive Visual Basic and C# source code that can be purchased on an 'as needed' basis.

In 2007 I established a .NET search engine, 'Resources for .NET Developers' at http://dot-net-resources-swicki.eurekster.com

Copyright 1998-2009 vbCity.com LLC
Powered by Community Server (Non-Commercial Edition), by Telligent Systems