Ad space (banner)
๐Ÿ”ทVB.NET Lessons
Lesson 20 / 68

Splitting and joining strings (Split and Join)

This lesson covers splitting and joining strings with VB.NET's Split and Join, with the aim of handling CSV-style data.

Split() breaks a string apart at a delimiter and String.Join() joins an array back into a single string. Both come up constantly when turning delimited data into an array, or an array into readable text.

The sample code splits a comma-separated string into an array with csv.Split(","c) and rebuilds it as a slash-separated string with String.Join(" / ", fruits). Note the c suffix in ","c, which marks a character literal — a VB.NET particularity.

A common early stumble is the type of the delimiter. VB.NET distinguishes the single-character Char from the multi-character String, and which one Split takes depends on the overload.

In professional work, Split and Join turn up constantly whenever delimited text is handled — reading CSV files, parsing logs.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run VB.NET directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)