Platforms to show: All Mac Windows Linux Cross-Platform

SplitCommaSeparatedValuesMBS(text as string, delimiter as string = "", quote as string = "") as string()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method String MBS Util Plugin 11.3 Yes Yes Yes Yes No
Function: Splits a string with CSV values.
// 1. read a CSV file:

dim file as FolderItem = SpecialFolder.Desktop.Child("test.csv")
dim t as TextInputStream =

// use right encoding for your file!
t.Encoding = encodings.MacRoman

while not t.EOF
dim line as string = t.ReadLine
dim items() as string = SplitCommaSeparatedValuesMBS(line)

// process items array

// 2. compare with split:

dim test as string = "Hello,""World,test"",end"

dim a() as string = split(test, ",")
dim b() as string = SplitCommaSeparatedValuesMBS(test, ",")

MsgBox Join(a,EndOfLine)+EndOfLine+EndOfLine+Join(b,EndOfLine)
This function is better for CSV data than the Split function as it handles quoted text right.
For 17.5 we rewrote this function. Now auto detects the delimiter (comma or semicolon) if none passed. Default quote character is " if nothing is passed. Please only one character for delimiter.

Version 18.0 can detect tab character, too.

Some examples using this global method:

Some FAQ entries about this method:

Blog Entries

Xojo Developer Magazine

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Util Plugin.

The biggest plugin in space...

MBS Xojo Plugins