Files
marqdo/lib/文本.mq.md
T
cflmyandCursor 506de65dae 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>
2026-09-07 20:27:19 +08:00

1.2 KiB

title, description
title description
lib/文本 文本库加厚(中层 M4)。字面替换 — 正则请用 lib/正则。

去空白

+ `s`

> trim s

拆分

+ `s`
+ `sep`

> split value=s sep=sep

拼接

+ `xs`
+ `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=对齐