tobogganSe connecter

louise

The Louise language: compiler, runtime, std, tooling

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

std/string: replace (#56)

`string.replace s from to` replaces every occurrence of `from` in `s`
with `to`, left to right and without overlapping (`replace "aaa" "aa"
"b"` is "ba"). An empty `from` returns `s` unchanged, as `split` does
with an empty separator (Rust's str::replace would insert `to` between
every character instead). It is UTF-8 safe: it never combines `find`'s
byte index with `slice`'s character count (#34).

It is pure Louise, `join (split s from) to`, so there is no new runtime
extern and no ABI change; std/string keeps having no imports. A native
kernel can later replace the body behind the same signature.

tests/run/string_replace.lse covers no match, empty `from` and `to`,
overlap, multi-byte text in `s`, `from` and `to`, a whole-string match
and matches at both ends, on both backends.

Refs #38

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

olivier · il y a 2 h · 5ae4c9cc08cd9a0fe643f788a11d05dce455db15

Parents ef22dd0

3 fichiers modifiés, 44 ajouts, 1 suppressions