Skip to content

stdlib/string: 补组合操作 rwfunc + string·parsefloat(#157) - #343

Merged
miaobyte merged 2 commits into
masterfrom
feat/string-stdlib-and-networld-fs
Sep 14, 2026
Merged

miaobyte merged 2 commits into
masterfrom
feat/string-stdlib-and-networld-fs

Conversation

@miaobyte

@miaobyte miaobyte commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

变更

1. stdlib/string 补组合操作层(Closes #157

此前只有 native rwir 一层,本次补上组合操作,命名取 C/Python/Rust/TypeScript/Go 五语言共识名:

  • 查/比:eqfold count rfind
  • 修剪:trim trimstart trimend padstart padend
  • 切分/拼接:split splitn lines fields join cut
  • 替换:replace replacen
  • 大小写:capitalize title swapcase
  • 判定:isalpha isdigit isalnum isxdigit isspace isupper islower ispunct allinset

另新增 native rwir string·parsefloat(对齐 Go strconv.ParseFloat / Python float() / Rust parse::<f64>())——整串须消费完,否则 ValueError。配套 runtime 实现 + myrwircaps 注册 + rwir_internal.h 原型 + layout 返回类型推断。

2. stdlib/networld 新增 fs

native rwir(字节级)之上补文本级组合:readtext / writetext(UTF-8 往返)、match(shell 通配)、globgrepmulti(事务式多处编辑,全部成功才落盘)。

tutorial

新增 13-stdlib/string/03-search…07-classify14-networld/11-fs-text11-string/08-strconv 跟随调整。

Closes #157

🤖 Generated with Claude Code

miaobyte and others added 2 commits September 14, 2026 18:21
string 库此前只有 native rwir 一层,本次补上**组合操作**层,命名取
C/Python/Rust/TypeScript/Go 五语言共识名:

- 查/比:eqfold、count、rfind
- 修剪:trim、trimstart、trimend、padstart、padend
- 切分/拼接:split、splitn、lines、fields、join、cut
- 替换:replace、replacen
- 大小写:capitalize、title、swapcase
- 判定:isalpha/isdigit/isalnum/isxdigit/isspace/isupper/islower/ispunct、allinset

另新增 native rwir **string·parsefloat**(对齐 Go strconv.ParseFloat /
Python float() / Rust parse::<f64>()):整串须消费完,否则 ValueError。
配套:runtime/rwir_string.c 实现、myrwircaps 注册、rwir_internal.h 原型、
layout/lower.rs 返回类型推断(→ float64)。

tutorial:新增 13-stdlib/string/03-search…07-classify,11-string/08-strconv
跟随调整;kvlangbrief 速览同步。

Closes #157

Co-Authored-By: Claude Code <noreply@anthropic.com>
native rwir(字节级,runtime-rs:size/read/write/append/list/del/mkdir/
exists)之上补文本级组合:

- readtext / writetext  文件 ↔ []char/utf32 文本(UTF-8 解码/编码往返)
- match                 名字段 shell 通配(* 任意串、? 单字符)
- glob                  按通配展开路径
- grep                  逐行查找(文件或目录下匹配 glob 的成员)
- multi                 事务式多处编辑(逐条精确替换,全部成功才落盘)

文本约定:按 UTF-8 解码为 []char/utf32 后操作(只有定宽 char/utf32 可索引
/切片),落盘再编码回 UTF-8;字节级 I/O 仍走 native rwir。

tutorial:新增 14-networld/11-fs-text。

Co-Authored-By: Claude Code <noreply@anthropic.com>
@miaobyte
miaobyte merged commit b884a64 into master Sep 14, 2026
2 of 6 checks passed
@miaobyte
miaobyte deleted the feat/string-stdlib-and-networld-fs branch September 14, 2026 10:27
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.

[FEAT] 2-runtime:stdlib: lib string —— 为 string· native rwir 补 rwfunc 封装库

1 participant