Oxygen Basic
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Latest OxygenBasic.zip at GitHub
(Click on the Wizard)
Home
Help
Search
Login
Register
Oxygen Basic
»
Programming
»
Problems & Solutions
»
STRREVERSE
« previous
next »
Print
Pages: [
1
]
Author
Topic: STRREVERSE (Read 983 times)
0 Members and 1 Guest are viewing this topic.
JRS
Guest
STRREVERSE
«
on:
May 02, 2018, 09:23:07 PM »
Code: OxygenBasic
function
StrReverse(
string
s)
as
string
=======================================
int
le=
len
s
int
j=le
int
i
string
t=
nuls
le
byte
bs
at
strptr
s
byte
bt
at
strptr
t
indexbase
1
for
i=1
to
le
bt[j]=bs[i]
j--
next
return
t
end
function
'
'TEST:
======
print
StrReverse "1234ABCD"
Code: Script BASIC
OPEN
"warpeace.txt"
FOR
INPUT
AS
1
flen =
FILELEN
(
"warpeace.txt"
)
fstr =
INPUT
(flen, 1)
rev =
STRREVERSE
(fstr)
PRINT
LEFT
(rev,500),
"\n"
jrs@jrs-laptop:~/sb/examples/test$ time scriba strrev.sb
.suoicsnoc ton era ew hcihw
fo ecnedneped a ezingocer ot dna ,tsixe ton seod taht modeerf a
ecnuoner ot yrassecen ylralimis si ti esac tneserp eht ni ;leef ton
did ew noitom a ezingocer ot dna ecaps ni ytilibommi laernu na fo
ssensuoicsnoc eht ecnuoner ot yrassecen saw ti esac tsrif eht nI
".swal ta evirra ew ,esuac no dna ,emit no ,dlrow
lanretxe eht no ecnedneped ruo gnittimda yb elihw ,ytidrusba ta evirra
ew lliw eerf ruo gnittimda yb tub ,ecnedneped ruo fo suoicsnoc
ton era ew taht eurt si
real 0m0.089s
user 0m0.060s
sys 0m0.000s
jrs@jrs-laptop:~/sb/examples/test$
Logged
Print
Pages: [
1
]
« previous
next »
Oxygen Basic
»
Programming
»
Problems & Solutions
»
STRREVERSE