mirror of
https://github.com/fluffos/fluffos
synced 2026-08-12 18:26:06 -04:00
* docs: add local full-text search and a contributor README Add @easyops-cn/docusaurus-search-local to the Docusaurus site so the docs get an offline search bar (index built at build time, no external service). English and zh-CN pages are both indexed, and matched terms are highlighted on the target page. Add docs/README.md describing the Docusaurus setup, local dev/build commands, search behavior, directory layout, and gotchas; exclude it from the published site alongside CLAUDE.md. Point the root README's docs/ entry at it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSzcESzU9947zkGzQ6SMmE * docs: remove dead framework leftovers, fix index generation, complete the nav Delete the VitePress (.vitepress/) and Jekyll (_layouts/, css/) leftovers, the one-shot migration scripts (fix_md_header.py, fix_seealso.py), and the stale keywords.json snapshot; prune the matching .gitignore entries and docusaurus exclude patterns. Rewrite gen_index.py for Docusaurus: it emitted dead .html links and legacy 'layout: doc' frontmatter, choked on non-markdown entries, and dropped nested categories — regenerating an index would have broken it. It now emits the extension-less links the site actually uses, links nested category indexes (restoring apply/* on the zh-CN index), and refuses to run on the docs root. Fix update_index.sh's copy-paste titles (zh-CN efun/build were titled 'APPLY'), stop it clobbering the hand-written lpc/index.md, and cover cli/. Regenerated indexes pick up the missing driver/ffi-plan entry. add_missing_efuns.py now takes the keywords.json path as an argument instead of requiring a stale copy. Move CNAME and the Google site-verification file into static/ so they actually reach the published build output. Complete the sidebar: link the CLI category to cli/index and add the missing portbind/symbol/generate_keywords pages, and expose the previously orphaned stdlib section under Reference. Promote onBrokenLinks to 'throw' now the build is warning-free, and drop the empty Demo section from the landing page. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSzcESzU9947zkGzQ6SMmE * docs: strip legacy 'layout: doc' frontmatter from all pages Mechanical sweep removing the Jekyll-era 'layout: doc' line from every doc page's frontmatter (Docusaurus ignores it), and the matching line from the templates in docs/CLAUDE.md so new pages don't reintroduce it. No content changes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSzcESzU9947zkGzQ6SMmE --------- Co-authored-by: Claude <noreply@anthropic.com>
55 lines
1.9 KiB
Markdown
55 lines
1.9 KiB
Markdown
---
|
||
title: strings / replace_string
|
||
---
|
||
# replace_string
|
||
|
||
### NAME
|
||
|
||
replace_string() - replace all instances of a string within a string
|
||
|
||
### SYNOPSIS
|
||
|
||
string replace_string( str, pattern, replace );
|
||
string replace_string( str, pattern, replace, max );
|
||
string replace_string( str, pattern, replace, first, last );
|
||
|
||
string str, pattern replace;
|
||
int max, first, last;
|
||
|
||
### DESCRIPTION
|
||
|
||
replace_string() returns str with all instances of pattern replaced
|
||
with replace. If pattern has zero length then str is returned unmodi‐
|
||
fied. If the resultant string would exceed the maximum string length
|
||
then replace_string() returns an undefinedp(), non-stringp() value.
|
||
|
||
replace_string() can be used to remove characters from a string by
|
||
specifying a pattern and a zero-length replace parameter. For example,
|
||
replace_string(" 1 2 3 ", " ", "") would return "123".
|
||
replace_string() executes faster this way then explode()/implode().
|
||
|
||
The 4th and 5th arguments are optional (to retain backward compatibil‐
|
||
ity.) The extra arguments have the following effect:
|
||
|
||
4 args
|
||
The 4th argument specifies the maximum number of replacements to
|
||
make (the count starts at 1). A value of 0 implies 'replace all',
|
||
and thus, acts as replace_string() with 3 arguments would. E.g.,
|
||
replace_string("xyxx", "x", "z", 2) would return "zyzx".
|
||
|
||
5 args
|
||
The 4th and 5th arguments specify the range of matches to replace
|
||
between, with the following constraints:
|
||
- first < 1 : change all from the start.
|
||
- last == 0, or last > max_matches : change all to end
|
||
- first > last : return the unmodified array.
|
||
E.g., replace_string("xyxxy", "x", "z", 2, 3) returns "xyzzy".
|
||
|
||
### SEE ALSO
|
||
|
||
sscanf(3), explode(3), strsrch(3)
|
||
|
||
### AUTHOR
|
||
|
||
Zak@TMI-2 wrote the range constraint additions.
|
||
|