diff --git a/src/solstice_stdlib.cpp b/src/solstice_stdlib.cpp index 846aa57..7fd223b 100644 --- a/src/solstice_stdlib.cpp +++ b/src/solstice_stdlib.cpp @@ -28,6 +28,22 @@ def println(string msg) string { return msg } +def stringToInt(string in) int { + result = 0 + ground { + stoi $in &result + } + return result +} + +def intToString(int in) string { + result = "" + ground { + tostring $in &result + } + return result +} + // End Solstice stdlib )"; diff --git a/tests/convert.sols b/tests/convert.sols new file mode 100644 index 0000000..c99068f --- /dev/null +++ b/tests/convert.sols @@ -0,0 +1,8 @@ +myString = "312" +myInt = 435 + +myNewString = intToString(myInt) +myNewInt = stringToInt(myString) + +println(myNewString) +puts myNewInt