Skip to content

replaceAll doesn't allow replacements that change the string length #1563

Closed
@ColinEberhardt

Description

@ColinEberhardt

"abcde".replaceAll("a", "---") results in the string ---bc, whereas I would expect it to return ---bcde.

To reproduce:

import "wasi";
import { Console} from "as-wasi";

const foo = "abcde".replaceAll("a", "---");
Console.log(foo);
{
  "scripts": {
    "build": "asc assembly/index.ts -b build/index.wasm -t build/index.wat --runtime half",
    "start": "wasmtime --dir . build/index.wasm"
  },
  "devDependencies": {
    "assemblyscript": "0.17.3"
  },
  "dependencies": {
    "as-wasi": "0.4.4"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions