JS strings have no trailing zero anymore (#8936)
This commit is contained in:
parent
7107ec05de
commit
9ba80d2044
3 changed files with 22 additions and 35 deletions
|
|
@ -2741,12 +2741,11 @@ type
|
|||
when defined(JS):
|
||||
proc add*(x: var string, y: cstring) {.asmNoStackFrame.} =
|
||||
asm """
|
||||
var len = `x`.length-1;
|
||||
var len = `x`.length;
|
||||
for (var i = 0; i < `y`.length; ++i) {
|
||||
`x`[len] = `y`.charCodeAt(i);
|
||||
++len;
|
||||
}
|
||||
`x`[len] = 0
|
||||
"""
|
||||
proc add*(x: var cstring, y: cstring) {.magic: "AppendStrStr".}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue