Skip to content

Commit

Permalink
try to make examples less confusing
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr committed Sep 11, 2024
1 parent 61aac58 commit 681bff9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docs/api/05-language-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1244,20 +1244,23 @@ let hexMut: mutbytes = mutbytes.fromHex("68656c6c6f");
#### Converting bytes to other types
```TS
let rawData: bytes = // ...
// bytes or mutbytes can be converted to other formats
let asString: str = rawData.toString();
let asRaw: Array<num> = rawData.toRaw();
let asBase64: str = rawData.toBase64();
let asHex: str = rawData.toHex();
// for conversion between bytes and mutbytes
// bytes and mutbytes can be copied and converted to each other
let asMutBytes: mutbytes = rawData.copyMut();
let asBytes: bytes = rawData.copy();
let asBytes: bytes = asMutBytes.copy();
```
#### Working with bytes
```TS
let concatenated: bytes = rawData.concat(rawString);
let concatenated: bytes = rawData.concat(rawData);
let sliced: bytes = rawData.slice(1, 3);
let length: num = rawData.length;
Expand Down

0 comments on commit 681bff9

Please sign in to comment.