Skip to content

std.string: str.rfind, trim_start/trim_end as views, bytes() (D105, #2206) - #2227

Merged
ehartford merged 2 commits into
global-demotion-loudfrom
str-helpers
Oct 7, 2026
Merged

ehartford merged 2 commits into
global-demotion-loudfrom
str-helpers

Conversation

@ehartford

@ehartford ehartford commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Three impl str methods beside as_bytes, no intrinsics: rfind (find from the other end, -1 when absent), trim_start/trim_end as &str views (D71 slices, never a copy; trim still copies, #2225), and bytes() as an @[iter_of_self] ephemeral ByteIter. Delegated decision D105 (D98) in the decision log.

Fixes #2206. Draft until the stack's battery is green.

…2206)

Three `impl str` methods beside `as_bytes`, no intrinsics: `rfind` is
`find` from the other end (-1 when absent, an empty needle at `len()`);
`trim_start`/`trim_end` are `&str` views past leading / before trailing
ASCII whitespace (D71 slices, O(1), never a copy — `trim` still copies,
#2225); `bytes()` is an `@[iter_of_self]` ephemeral `ByteIter` over the
bytes. Delegated decision D105 in the log. The behavior test fails on the
installed compiler with "unknown method 'rfind' for type 'str'".
@ehartford
ehartford added this pull request to stack #2228 October 6, 2026 23:28
@ehartford ehartford changed the title str helpers std.string: str.rfind, trim_start/trim_end as views, bytes() (D105, #2206) Oct 6, 2026
…eIter.next adds to every program's prelude (41, 13)
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on stack top bfecc6f (seed-driven, with run tools/battery.w): gate rc=0 399s, uat rc=0 28s, battery-checks rc=0 397s.

@ehartford
ehartford marked this pull request as ready for review October 7, 2026 02:14
@ehartford
ehartford merged commit 044b17b into main Oct 7, 2026
@ehartford
ehartford deleted the str-helpers branch October 7, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

str has no rfind, bytes() or trim_start(): a one-off With tool had to hand-roll each

1 participant