Platforms to show: All Mac Windows Linux Cross-Platform
/Util/SplitCommaSeparatedValuesMBS
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/SplitCommaSeparatedValuesMBS
This example is the version from Thu, 10th Jan 2018.
Project "SplitCommaSeparatedValuesMBS.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// easy case
test SplitCommaSeparatedValuesMBS("Hello,World,test"), array("Hello","World","test")
// with quotes
test SplitCommaSeparatedValuesMBS("""Hello"",""World"",""test"""), array("Hello","World","test")
// with quotes on middle
test SplitCommaSeparatedValuesMBS("Hello,""World"",test"), array("Hello","World","test")
// with quotes on end
test SplitCommaSeparatedValuesMBS("Hello,""World"",""test"""), array("Hello","World","test")
// without delimiter
test SplitCommaSeparatedValuesMBS("Hello"), array("Hello")
// without delimiter, but with quotes
test SplitCommaSeparatedValuesMBS("""Hello"""), array("Hello")
// with a missing quote
test SplitCommaSeparatedValuesMBS("""Hello"), array("Hello")
// with a missing quote
test SplitCommaSeparatedValuesMBS("Hello, World"""), array("Hello", " World")
// with quotes on end, one missing
test SplitCommaSeparatedValuesMBS("Hello,""World"",""test"), array("Hello","World","test")
// other delimiter
test SplitCommaSeparatedValuesMBS("Hello;World;test", ";"), array("Hello","World","test")
// long delimiter
test SplitCommaSeparatedValuesMBS("Hello---World---test", "-"), array("Hello", "", "", "World","", "", "test")
// other delimiter, other quote
test SplitCommaSeparatedValuesMBS("Hello;'World';'test'", ";", "'"), array("Hello","World","test")
MsgBox "OK"
quit
End EventHandler
Sub test(q() as string, a() as string)
if UBound(q) = UBound(a) then
dim u as integer = UBound(a)
for i as integer = 0 to u
if q(i) = a(i) then
// okay
else
MsgBox "Failed"+EndOfLine+Join(a,",")+EndOfLine+join(q,",")
quit
end if
next
'MsgBox "OK"
else
MsgBox "Failed ubound"+EndOfLine+Join(a,",")+EndOfLine+join(q,",")
quit
end if
End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
The items on this page are in the following plugins: MBS Util Plugin.