Last active
October 26, 2020 11:16
-
-
Save nonkit/abf5b28e0ca38772c9467dff3bb796d3 to your computer and use it in GitHub Desktop.
Small Basic Online Split Shape Array Subroutine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This subroutine is a sample to split "index=value;" format as array for Small Basic Online v0.91, v1.0 and MySmallBasic.