Hello:
I was wondering if there's a way to obtain characters in a string or the length of a string using lci. I am trying to count the number of "a","s", "d" and "f" in an input string (code below). I've managed to run my code in loljs (
http://asgaard.co.uk/misc/loljs/), but lci seems to not recognize "LENGTH OF" or the "!" for index. I like having a local interpreter and the error messages in lci better.
Thanks!
Jaws
OBTW
This code was interpreted using loljs:
http://asgaard.co.uk/misc/loljs/#TLDR
HAI 1.3
CAN HAS STDIO?
BTW read in the nucleotides from stdin
I HAS A my_string
GIMMEH my_string
my_string IS NOW A YARN
BTW initialize variables
I HAS A a ITZ 0
a IS NOW A NUMBR
I HAS A s ITZ 0
s IS NOW A NUMBR
I HAS A d ITZ 0
d IS NOW A NUMBR
I HAS A f ITZ 0
f IS NOW A NUMBR
I HAS A i ITZ 0
i IS NOW A NUMBR
IM IN YR my_loop UPPIN YR i TIL BOTH SAEM i AN LEN OF my_string
I HAS A char ITZ my_string!i
char, WTF?
OMG "A"
OMG "a"
a R SUM OF a AN 1
GTFO
OMG "S"
OMG "s"
s R SUM OF s AN 1
GTFO
OMG "D"
OMG "d"
d R SUM OF d AN 1
GTFO
OMG "F"
OMG "f"
f R SUM OF f AN 1
GTFO
OMGWTF
GTFO
OIC
IM OUTTA YR my_loop
VISIBLE SMOOSH a " " s " " d " " f MKAY
KTHXBYE