feat(stdlib): Mid M4 csv and thickened text helpers

Add lib/csv parse/stringify and expand lib/text with contains,
replace, case, pad, and related golds plus public demos.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-07 20:27:19 +08:00
1 parent 08384c7540
commit 506de65dae
22 files changed
+766 -15

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
---
title: lib/csv
description: RFC4180-ish CSV parse/stringify (Mid M4). First row = headers → list of maps.
---
## parse
+ `text`
**> host_csv_parse text=`text`**
## stringify
+ `rows`
**> host_csv_stringify rows=`rows`**
+55 -1
View File
@@ -1,6 +1,6 @@
---
title: lib/text
description: English text helpers over trim / split / join
description: Text helpers (Mid M4 thicken). Literal replace — use lib/re for regex.
---
## str_trim
@@ -19,3 +19,57 @@ description: English text helpers over trim / split / join
+ `sep`
**> join value=`xs` sep=`sep`**
## contains
+ `text`
+ `sub`
**> host_text_contains text=`text` sub=`sub`**
## starts_with
+ `text`
+ `prefix`
**> host_text_starts_with text=`text` prefix=`prefix`**
## ends_with
+ `text`
+ `suffix`
**> host_text_ends_with text=`text` suffix=`suffix`**
## replace
+ `text`
+ `old`
+ `new`
+ `count`=None
Literal substring replace (`count` optional).
**> host_text_replace text=`text` old=`old` new=`new` count=`count`**
## to_upper
+ `text`
**> host_text_to_upper text=`text`**
## to_lower
+ `text`
**> host_text_to_lower text=`text`**
## repeat
+ `text`
+ `n`
**> host_text_repeat text=`text` n=`n`**
## pad
+ `text`
+ `width`
+ `fill`=None
+ `align`=None
align: left (default), right, or center.
**> host_text_pad text=`text` width=`width` fill=`fill` align=`align`**
+55 -1
View File
@@ -1,6 +1,6 @@
---
title: lib/文本
description: 中文文本库:去空白 / 拆分 / 拼接
description: 文本库加厚(中层 M4)。字面替换 — 正则请用 lib/正则。
---
## 去空白
@@ -19,3 +19,57 @@ description: 中文文本库:去空白 / 拆分 / 拼接
+ `sep`
**> join value=`xs` sep=`sep`**
## 包含
+ `内容`
+ `子串`
**> host_text_contains text=`内容` sub=`子串`**
## 开头是
+ `内容`
+ `前缀`
**> host_text_starts_with text=`内容` prefix=`前缀`**
## 结尾是
+ `内容`
+ `后缀`
**> host_text_ends_with text=`内容` suffix=`后缀`**
## 替换
+ `内容`
+ `旧`
+ `新`
+ `次数`=None
字面子串替换(可选 `次数`)。
**> host_text_replace text=`内容` old=`旧` new=`新` count=`次数`**
## 大写
+ `内容`
**> host_text_to_upper text=`内容`**
## 小写
+ `内容`
**> host_text_to_lower text=`内容`**
## 重复
+ `内容`
+ `次数`
**> host_text_repeat text=`内容` n=`次数`**
## 填充
+ `内容`
+ `宽度`
+ `填充符`=None
+ `对齐`=None
对齐:left(默认)/ right / center。
**> host_text_pad text=`内容` width=`宽度` fill=`填充符` align=`对齐`**
+14
View File
@@ -0,0 +1,14 @@
---
title: lib/逗号表
description: CSV 解析/序列化(中层 M4)。首行为表头 → 映射列表。
---
## 解析
+ `内容`
**> host_csv_parse text=`内容`**
## 序列化
+ `行集`
**> host_csv_stringify rows=`行集`**