September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
21
Task/Binary-strings/Zkl/binary-strings.zkl
Normal file
21
Task/Binary-strings/Zkl/binary-strings.zkl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Data(0,.Int,1,2,3) // bytes
|
||||
Data(0,String,1,2,3) // same
|
||||
Data(0,Int,"foo","bar") //-->foobar\0
|
||||
d:=Data(0,String,"foo","bar") //-->foo\0bar\0\0
|
||||
d==d // -->True: byte by byte comparison
|
||||
d.copy() //-->clone
|
||||
d.len() //-->8, 0 if empty
|
||||
|
||||
d.append("1").len(); //-->10 // or d+"1"
|
||||
Data(0,Int,"foo","bar").len() //-->6
|
||||
Data(0,Int,"foo","bar").append("1").len() //-->7
|
||||
|
||||
d.readString(4) //-->"bar"
|
||||
d.readNthString(2) //-->"1"
|
||||
d[2,4] //-->"o", really "o\0ba" but String sees the null
|
||||
|
||||
while(Void!=(n:=d.findString("bar"))){ d[n,4]="hoho" }
|
||||
d.bytes() //-->L(102,111,111,0,104,111,104,111,0,49,0)
|
||||
|
||||
d2:=Data(0,Int,"sam");
|
||||
d.append(d2).text // or d+d2
|
||||
Loading…
Add table
Add a link
Reference in a new issue