diff options
author | Justyna Ilczuk <justyna.ilczuk@gmail.com> | 2013-01-12 22:16:30 +0100 |
---|---|---|
committer | Justyna Ilczuk <justyna.ilczuk@gmail.com> | 2013-01-12 22:16:30 +0100 |
commit | 53f8ba2097355f7f488ed04b1d86d037e47216f2 (patch) | |
tree | 533fd39064f4148b61c943fdc25d0338a4d5b5d4 /Sencha-lang/Examples/strings.se | |
parent | 3a449cb09b812ef7017f584ff3968c40a4f6a83a (diff) | |
download | sencha-lang-imports.tar.gz sencha-lang-imports.tar.bz2 sencha-lang-imports.tar.xz sencha-lang-imports.zip |
Some new examples. New tests. Small improvements.imports
Diffstat (limited to 'Sencha-lang/Examples/strings.se')
-rw-r--r-- | Sencha-lang/Examples/strings.se | 19 |
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 |