summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/writeup2/examples/str_example.zpy
diff options
context:
space:
mode:
Diffstat (limited to 'comp/lucas-standen-NEA/writeup2/examples/str_example.zpy')
-rw-r--r--comp/lucas-standen-NEA/writeup2/examples/str_example.zpy17
1 files changed, 17 insertions, 0 deletions
diff --git a/comp/lucas-standen-NEA/writeup2/examples/str_example.zpy b/comp/lucas-standen-NEA/writeup2/examples/str_example.zpy
new file mode 100644
index 0000000..9d2abd1
--- /dev/null
+++ b/comp/lucas-standen-NEA/writeup2/examples/str_example.zpy
@@ -0,0 +1,17 @@
+(defun main int)
+ (let str:string* (String "hello_world"))
+ (printstr str->_str)
+ (printchar '\n')
+
+ (let strs:string** (str->split str '_'))
+
+ (printstr strs[0]->_str)
+ (printchar '\n')
+ (printstr strs[1]->_str)
+ (printchar '\n')
+
+ (strs[0]->free strs[0])
+ (strs[1]->free strs[1])
+ (free strs)
+ (str->free str)
+(endfun)