Skip to content

Instantly share code, notes, and snippets.

@nonkit
Last active October 26, 2020 11:16
Show Gist options
  • Save nonkit/abf5b28e0ca38772c9467dff3bb796d3 to your computer and use it in GitHub Desktop.
Save nonkit/abf5b28e0ca38772c9467dff3bb796d3 to your computer and use it in GitHub Desktop.
Small Basic Online Split Shape Array Subroutine
Sub SBO_SplitParam
' Small Basic Online | split "index=value;" format as an array param
' param param[] - to split
' return param[] - split
_param = ""
p = 1
len = Text.GetLength(param)
While p <= len
eq = Text.GetIndexOf(Text.GetSubTextToEnd(param, p), "=")
sc = Text.GetIndexOf(Text.GetSubTextToEnd(param, p), ";")
name = Text.GetSubText(param, p, eq - 1)
value = Text.GetSubText(param, p + eq, sc - eq - 1)
_param[name] = value
p = p + sc
EndWhile
param = _param
EndSub
Sub SBO_SplitShape
' Small Basic Online | split "index=value;" format as a jagged array shape
' param shape[] - to split
' return shape[] - split
arry = shape
n = Array.GetItemCount(arry)
For i = 1 To n
param = arry[i]
SBO_SplitParam()
arry[i] = param
EndFor
shape = arry
EndSub
@nonkit
Copy link
Author

nonkit commented Apr 8, 2019

This subroutine is a sample to split "index=value;" format as array for Small Basic Online v0.91, v1.0 and MySmallBasic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment