Skip to content

v2.9.0 - Wasm: String replaceAll / replaceFirst

Choose a tag to compare

@gmpassos gmpassos released this 18 Jul 08:40
· 137 commits to master since this release
bab8e58

Wasm: String replaceAll / replaceFirst

The on-the-fly WebAssembly compiler now supports replaceAll(from, to) and replaceFirst(from, to) over its [len][utf8] layout.

Each is compiled as two passes: the first counts non-overlapping matches to size the output buffer, the second builds it (copying to for a match, else one byte). Handles a replacement that grows, shrinks, or removes the match, and matches at either end; an empty from returns a copy (avoiding a non-terminating scan).

These join the String methods added in 2.7.0/2.8.0 (substring, codeUnitAt, startsWith/endsWith, indexOf, contains, trim family, padLeft/padRight).

Still to come for String: split (returns a List), index [], and compareTo (which also needs String.compareTo in the interpreter core first).

Full changelog: https://github.com/ApolloVM/apollovm_dart/blob/v2.9.0/CHANGELOG.md