fluffos/docs/stdlib/string/break_string.md
Yucong Sun c914f03d66
Add local search and documentation guide for docs site (#1221)
* 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>
2026-07-09 22:09:55 -04:00

110 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: stdlib / break_string
---
# break_string
### NAME
break_string
### SYNOPSIS
string break_string(string str)
string break_string(string str, int width)
string break_string(string str, int width, string indent)
string break_string(string str, int width, int space)
string break_string(string str, int width, string indent, int flags)
string break_string(string str, int width, int space, int flags)
### ARGUMENTS
str - string to wrap
width - optional: maximum line length (default 78)
indent - optional: String that appears before each broken line
space - optional: number of spaces before each broken line
flags - optional: this allows the behavior of break_string ()
to change; for possible flags see point 'description'
DESCRIPTION
============
In the first form, the string 'str' is changed by inserting "\n"
broken that with a subsequent output line no longer as 'width' characters.
Possibly existing "\n" in 'str' are removed beforehand.
If you also add a string 'indent', this will be used to set each of
the wrapped lines.
Similarly, when specifying the number 'space', a string with 'space'
characters in front of each broken line.
In addition, there are the following optional flags, which can be combined as desired
can:
       BS_LEAVE_MY_LFS - "\n" that already exist in the text are retained
       BS_SINGLE_SPACE - double spaces and spaces after line
                          breaks are removed
       BS_BLOCK - the text is formatted in justification
       BS_NO_PARINDENT - for justification with specified line breaks
                           (BS_BLOCK | BS_LEAVE_MY_LFS) lines after "\ n"
                           usually started with a space.
                           To insert the leading space
                           suppress, BS_NO_PARINDENT must be specified
       BS_INDENT_ONCE - the first line of the text is preceded by
                           output 'indent'; get all the following lines
                           preceded by an empty string
       BS_PREPEND_INDENT - the Ident is prepended to the text if the
                           Indent + Text is longer than one line. The text
                           is indented by a space, which is done using
                           BS_NO_PARINDENT can be prevented.
RETURN VALUE
=============
The wrapped text.
Runtime error if the indent is longer than the specified width.
EXAMPLES
=========
write(break_string("This is a longer text. Just as an example.", 27));
 => This is a longer
      Text. Just as an example.
write(break_string("It looks like this with indent", 30, "Wargon says: "));
=> Wargon says: It looks like
Wargon says: this with indent
write(break_string ("It looks like this with indent", 30, "Wargon says: ",
BS_INDENT_ONCE));
=> Wargon says: It looks like
this with indent
write(break_string("It looks like this with spaces", 30, 2));
=> It looks like this with
spaces
write(break_string("I want it\nbut pre-formatted!",60,
"Wargon says: ", BS_LEAVE_MY_LFS));
=> Wargon says: I want it
Wargon says: but pre-formatted!
write(break_string("I want it\nbut pre-formatted!",30,
"Wargon says: ", BS_LEAVE_MY_LFS | BS_PREPEND_INDENT));
=> Wargon says:
I want it
but pre-formatted!
### AUTHOR
senderwiederholung