15 lines
373 B
Plaintext
15 lines
373 B
Plaintext
cmp_str(u,v)=u==v
|
|
copy_str(v)=v \\ Creates a copy, not a pointer
|
|
append_str(v,n)=concat(v,n)
|
|
replace_str(source, n, replacement)=my(v=[]);for(i=1,#source,v=concat(v,if(source[i]==n,replacement,source[i]))); v
|
|
|
|
u=[72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100];
|
|
v=[];
|
|
cmp_str(u,v)
|
|
w=copy_str(v)
|
|
#w==0
|
|
append_str(u,33)
|
|
u[8..12]
|
|
replace_str(u,108,[121])
|
|
concat(v,w)
|