mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-26 15:32:16 +00:00
19 lines
433 B
TypeScript
19 lines
433 B
TypeScript
// preliminary
|
|
|
|
var str: string = "hi, I'm a string";
|
|
|
|
// exactly once in static memory
|
|
assert(changetype<usize>(str) === changetype<usize>("hi, I'm a string"));
|
|
|
|
assert(str.length == 16);
|
|
assert(str.charCodeAt(0) == 0x68);
|
|
assert(str.startsWith("hi"));
|
|
assert(str.endsWith("string"));
|
|
assert(str.includes("I'm"));
|
|
assert(str.indexOf(",") == 2);
|
|
assert(str.indexOf("x") == -1);
|
|
|
|
export function getString(): string {
|
|
return str;
|
|
}
|