SHOW:
|
|
- or go back to the newest paste.
| 1 | - | sub strcopy(replacement as string, target as string) |
| 1 | + | |
| 2 | - | target = replacement |
| 2 | + | dim char as ubyte |
| 3 | dim as long iEnd = len(target)-1 | |
| 4 | for i as integer = 0 to iEnd\2 | |
| 5 | char = target[i] | |
| 6 | - | dim char as ubyte |
| 6 | + | target[i] = target[iEnd] |
| 7 | - | for i as integer = 0 to len(target) |
| 7 | + | target[iEnd] = char |
| 8 | - | char = target[i] |
| 8 | + | iEnd -= 1 |
| 9 | - | target[len(target)] = target[i] |
| 9 | + | next |
| 10 | - | target[i] = char |
| 10 | + | |
| 11 | - | next |
| 11 | + | |
| 12 | ' OR ... ' | |
| 13 | ||
| 14 | - | dim mystr as string = "lemon" |
| 14 | + | |
| 15 | - | print mystr |
| 15 | + | dim char as ubyte |
| 16 | - | strcopy("mango", mystr)
|
| 16 | + | dim as long iEnd = len(target)-1 |
| 17 | - | print mystr |
| 17 | + | for i as integer = 0 to iEnd\2 |
| 18 | swap target[i],target[iEnd] | |
| 19 | - | strrev(mystr) |
| 19 | + | iEnd -= 1 |
| 20 | - | print mystr |
| 20 | + | next |
| 21 | end sub | |
| 22 |