Represents a `Il2CppString`.
| 4 | |
| 5 | /** Represents a `Il2CppString`. */ |
| 6 | class Il2CppString extends native_struct.NativeStruct { |
| 7 | /** Gets the content of this string. */ |
| 8 | get content() { |
| 9 | return Il2Cpp.Api._stringChars(this).readUtf16String(this.length); |
| 10 | } |
| 11 | |
| 12 | /** Sets the content of this string. */ |
| 13 | set content(value) { |
| 14 | Il2Cpp.Api._stringChars(this).writeUtf16String(value); |
| 15 | Il2Cpp.Api._stringSetLength(this, value.length); |
| 16 | } |
| 17 | |
| 18 | /** Gets the length of this string. */ |
| 19 | get length() { |
| 20 | return Il2Cpp.Api._stringLength(this); |
| 21 | } |
| 22 | |
| 23 | /** Gets the encompassing object of the current string. */ |
| 24 | get object() { |
| 25 | return new Il2Cpp.Object(this); |
| 26 | } |
| 27 | |
| 28 | /** */ |
| 29 | toString() { |
| 30 | return this.isNull() ? "null" : `"${this.content}"`; |
| 31 | } |
| 32 | |
| 33 | /** Creates a new string with the specified content. */ |
| 34 | static from(content) { |
| 35 | return new Il2Cpp.String(Il2Cpp.Api._stringNew(Memory.allocUtf8String(content || ""))); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | Il2Cpp.String = Il2CppString; |
nothing calls this directly
no outgoing calls
no test coverage detected