summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Examples/strings.se
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/Examples/strings.se')
-rw-r--r--Sencha-lang/Examples/strings.se19
1 files changed, 19 insertions, 0 deletions
diff --git a/Sencha-lang/Examples/strings.se b/Sencha-lang/Examples/strings.se
new file mode 100644
index 0000000..a3a2bb3
--- /dev/null
+++ b/Sencha-lang/Examples/strings.se
@@ -0,0 +1,19 @@
+def slice(text, from, to)
+{
+ bit = "";
+ i = from;
+ while(i < to)
+ {
+ bit = bit + text[i];
+ i = i + 1;
+ }
+ return bit;
+}
+
+def replace(text, replacement, start_position, end_position)
+{
+ prefix = slice(text, 0, start_position);
+ suffix = slice(text, end_position, len(text));
+ result = prefix + replacement + suffix;
+ return result;
+} \ No newline at end of file