fix strsplit, fix a few loops
This commit is contained in:
parent
d3913cdc0b
commit
1ac0d7f0aa
1 changed files with 16 additions and 10 deletions
26
std.isbpl
26
std.isbpl
|
@ -150,8 +150,8 @@ func acopy {
|
||||||
=arr2
|
=arr2
|
||||||
=arr1
|
=arr1
|
||||||
|
|
||||||
0 =i
|
1 neg =i
|
||||||
while (i len lt) (i 1 + =i) {
|
while (i 1 + =i) (i len lt) {
|
||||||
arr2 i idx2 + (arr1 i idx1 + aget) aput
|
arr2 i idx2 + (arr1 i idx1 + aget) aput
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,27 +174,33 @@ func strsplit {
|
||||||
_string =str
|
_string =str
|
||||||
_string =splitter
|
_string =splitter
|
||||||
|
|
||||||
0 =i
|
1 neg =i
|
||||||
0 =j
|
|
||||||
"" 0 anew =sequences
|
"" 0 anew =sequences
|
||||||
while (i str alen lt) (i 1 + =1) {
|
while (i 1 + =1) (i str alen lt) {
|
||||||
str i aget =chr
|
str i aget =chr
|
||||||
splitter 0 aget =spl
|
splitter 0 aget =spl
|
||||||
while (chr spl eq) (j 1 + =j) {
|
"" =sequence
|
||||||
|
1 neg =j
|
||||||
|
while (j 1 + =j) (chr spl eq) {
|
||||||
(str i j + aget) (splitter j aget) eq not if {
|
(str i j + aget) (splitter j aget) eq not if {
|
||||||
sequences =oldsq
|
sequences =oldsq
|
||||||
"" (seq dup =lseq 1 + dup =seq) anew =sequences
|
"" (sequences alen dup =seq 1 +) anew =sequences
|
||||||
oldsq sequences 0 0 oldsq alen acopy
|
oldsq sequences 0 0 oldsq alen acopy
|
||||||
sequences lseq
|
sequences seq sequence aput
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sequence chr strconcat =sequence
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sequences
|
||||||
}
|
}
|
||||||
|
|
||||||
func puts {
|
func puts {
|
||||||
_string =str
|
_string =str
|
||||||
0 =i
|
1 neg =i
|
||||||
while (i str alen lt) (i 1 + =i) {
|
while (i 1 + =i) (i str alen lt) {
|
||||||
str i aget putchar
|
str i aget putchar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue