diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-05 00:40:00 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-05 00:40:00 -0500 |
| commit | 9a3162633d358c9dc698b2733027981203514dc9 (patch) | |
| tree | 38f6ebd8121f5dab2f04173dda8b9cefd2de1fdf /docs/text.md | |
| parent | dba2d62d15d8233c189a109f97d7cda70fa7f6b7 (diff) | |
Shorten API docs
Diffstat (limited to 'docs/text.md')
| -rw-r--r-- | docs/text.md | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/docs/text.md b/docs/text.md index f06c303b..a97f3bcf 100644 --- a/docs/text.md +++ b/docs/text.md @@ -307,8 +307,6 @@ pattern documentation](patterns.md) for more details. - [`func utf32_codepoints(text: Text -> [Int32])`](#utf32_codepoints) ### `as_c_string` - -**Description:** Converts a `Text` value to a C-style string. **Signature:** @@ -316,8 +314,6 @@ Converts a `Text` value to a C-style string. func as_c_string(text: Text -> CString) ``` -**Parameters:** - - `text`: The text to be converted to a C-style string. **Returns:** @@ -332,8 +328,6 @@ A C-style string (`CString`) representing the text. --- ### `at` - -**Description:** Get the graphical cluster at a given index. This is similar to `str[i]` with ASCII text, but has more correct behavior for unicode text. @@ -342,8 +336,6 @@ ASCII text, but has more correct behavior for unicode text. func at(text: Text, index: Int -> Text) ``` -**Parameters:** - - `text`: The text from which to get a cluster. - `index`: The index of the graphical cluster (1-indexed). @@ -361,8 +353,6 @@ indices are counted from the back of the text, so `-1` means the last cluster, --- ### `by_line` - -**Description:** Returns an iterator function that can be used to iterate over the lines in a text. @@ -371,8 +361,6 @@ text. func by_line(text: Text -> func(->Text?)) ``` -**Parameters:** - - `text`: The text to be iterated over, line by line. **Returns:** @@ -394,8 +382,6 @@ for line in text:by_line(): --- ### `by_match` - -**Description:** Returns an iterator function that can be used to iterate over the occurrences of a pattern in a text. @@ -404,8 +390,6 @@ of a pattern in a text. func by_match(text: Text, pattern: Pattern -> func(->Match?)) ``` -**Parameters:** - - `text`: The text to be iterated over looking for matches. - `pattern`: The [pattern](patterns.md) to look for. @@ -425,8 +409,6 @@ for match in text:by_match($/{alpha}/): --- ### `by_split` - -**Description:** Returns an iterator function that can be used to iterate over text separated by a pattern. @@ -435,8 +417,6 @@ a pattern. func by_split(text: Text, pattern: Pattern = $// -> func(->Text?)) ``` -**Parameters:** - - `text`: The text to be iterated over in pattern-delimited chunks. - `pattern`: The [pattern](patterns.md) to split the text on. @@ -456,8 +436,6 @@ for chunk in text:by_split($/,/): --- ### `bytes` - -**Description:** Converts a `Text` value to an array of bytes representing a UTF8 encoding of the text. @@ -466,8 +444,6 @@ the text. func bytes(text: Text -> [Byte]) ``` -**Parameters:** - - `text`: The text to be converted to UTF8 bytes. **Returns:** @@ -482,8 +458,6 @@ An array of bytes (`[Byte]`) representing the text in UTF8 encoding. --- ### `codepoint_names` - -**Description:** Returns an array of the names of each codepoint in the text. **Signature:** @@ -491,8 +465,6 @@ Returns an array of the names of each codepoint in the text. func codepoint_names(text: Text -> [Text]) ``` -**Parameters:** - - `text`: The text from which to extract codepoint names. **Returns:** @@ -507,8 +479,6 @@ An array of codepoint names (`[Text]`). --- ### `each` - -**Description:** Iterates over each match of a [pattern](patterns.md) and passes the match to the given function. @@ -517,8 +487,6 @@ the given function. func each(text: Text, pattern: Pattern, fn: func(m: Match), recursive: Bool = yes -> Int?) ``` -**Parameters:** - - `text`: The text to be searched. - `pattern`: The [pattern](patterns.md) to search for. - `fn`: A function to be called on each match that was found. @@ -538,8 +506,6 @@ None. --- ### `ends_with` - -**Description:** Checks if the `Text` ends with a literal suffix text. **Signature:** @@ -547,8 +513,6 @@ Checks if the `Text` ends with a literal suffix text. func ends_with(text: Text, suffix: Text -> Bool) ``` -**Parameters:** - - `text`: The text to be searched. - `suffix`: The literal suffix text to check for. @@ -564,8 +528,6 @@ func ends_with(text: Text, suffix: Text -> Bool) --- ### `find` - -**Description:** Finds the first occurrence of a [pattern](patterns.md) in the given text (if any). @@ -574,8 +536,6 @@ any). func find(text: Text, pattern: Pattern, start: Int = 1 -> Int?) ``` -**Parameters:** - - `text`: The text to be searched. - `pattern`: The [pattern](patterns.md) to search for. - `start`: The index to start the search. @@ -599,8 +559,6 @@ struct containing information about the match. --- ### `find_all` - -**Description:** Finds all occurrences of a [pattern](patterns.md) in the given text. **Signature:** @@ -608,8 +566,6 @@ Finds all occurrences of a [pattern](patterns.md) in the given text. func find_all(text: Text, pattern: Pattern -> [Match]) ``` -**Parameters:** - - `text`: The text to be searched. - `pattern`: The [pattern](patterns.md) to search for. @@ -638,8 +594,6 @@ Note: if `text` or `pattern` is empty, an empty array will be returned. --- ### `from` - -**Description:** Get a slice of the text, starting at the given position. **Signature:** @@ -647,8 +601,6 @@ Get a slice of the text, starting at the given position. func from(text: Text, first: Int -> Text) ``` -**Parameters:** - - `text`: The text to be sliced. - `frist`: The index of the first grapheme cluster to include (1-indexed). @@ -670,8 +622,6 @@ the length of the string. --- ### `from_bytes` - -**Description:** Returns text that has been constructed from the given UTF8 bytes. Note: the text will be normalized, so the resulting text's UTF8 bytes may not exactly match the input. @@ -681,8 +631,6 @@ match the input. func from_codepoint_names(codepoints: [Int32] -> [Text]) ``` -**Parameters:** - - `codepoints`: The UTF32 codepoints in the desired text. **Returns:** @@ -697,8 +645,6 @@ A new text based on the input UTF8 bytes after normalization has been applied. --- ### `from_c_string` - -**Description:** Converts a C-style string to a `Text` value. **Signature:** @@ -706,8 +652,6 @@ Converts a C-style string to a `Text` value. func from_c_string(str: CString -> Text) ``` -**Parameters:** - - `str`: The C-style string to be converted. **Returns:** @@ -722,8 +666,6 @@ A `Text` value representing the C-style string. --- ### `from_codepoint_names` - -**Description:** Returns text that has the given codepoint names (according to the Unicode specification) as its codepoints. Note: the text will be normalized, so the resulting text's codepoints may not exactly match the input codepoints. @@ -733,8 +675,6 @@ resulting text's codepoints may not exactly match the input codepoints. func from_codepoint_names(codepoint_names: [Text] -> [Text]) ``` -**Parameters:** - - `codepoint_names`: The names of each codepoint in the desired text. Names are case-insentive. @@ -755,8 +695,6 @@ Any invalid names are ignored. --- ### `from_codepoints` - -**Description:** Returns text that has been constructed from the given UTF32 codepoints. Note: the text will be normalized, so the resulting text's codepoints may not exactly match the input codepoints. @@ -766,8 +704,6 @@ match the input codepoints. func from_codepoint_names(codepoints: [Int32] -> [Text]) ``` -**Parameters:** - - `codepoints`: The UTF32 codepoints in the desired text. **Returns:** @@ -782,8 +718,6 @@ A new text with the specified codepoints after normalization has been applied. --- ### `has` - -**Description:** Checks if the `Text` contains a target [pattern](patterns.md). **Signature:** @@ -791,8 +725,6 @@ Checks if the `Text` contains a target [pattern](patterns.md). func has(text: Text, pattern: Pattern -> Bool) ``` -**Parameters:** - - `text`: The text to be searched. - `pattern`: The [pattern](patterns.md) to search for. @@ -814,8 +746,6 @@ func has(text: Text, pattern: Pattern -> Bool) --- ### `join` - -**Description:** Joins an array of text pieces with a specified glue. **Signature:** @@ -823,8 +753,6 @@ Joins an array of text pieces with a specified glue. func join(glue: Text, pieces: [Text] -> Text) ``` -**Parameters:** - - `glue`: The text used to join the pieces. - `pieces`: The array of text pieces to be joined. @@ -840,8 +768,6 @@ A single `Text` value with the pieces joined by the glue. --- ### `lines` - -**Description:** Splits the text into an array of lines of text, preserving blank lines, ignoring trailing newlines, and handling `\r\n` the same as `\n`. @@ -850,8 +776,6 @@ ignoring trailing newlines, and handling `\r\n` the same as `\n`. func split(text: Text -> [Text]) ``` -**Parameters:** - - `text`: The text to be split into lines. **Returns:** @@ -874,8 +798,6 @@ An array of substrings resulting from the split. --- ### `lower` - -**Description:** Converts all characters in the text to lowercase. **Signature:** @@ -883,8 +805,6 @@ Converts all characters in the text to lowercase. func lower(text: Text -> Text) ``` -**Parameters:** - - `text`: The text to be converted to lowercase. **Returns:** @@ -899,8 +819,6 @@ The lowercase version of the text. --- ### `map` - -**Description:** For each occurrence of the given [pattern](patterns.md), replace the text with the result of calling the given function on that match. @@ -909,8 +827,6 @@ the result of calling the given function on that match. func map(text: Text, pattern: Pattern, fn: func(text:Match)->Text -> Text, recursive: Bool = yes) ``` -**Parameters:** - - `text`: The text to be searched. - `pattern`: The [pattern](patterns.md) to search for. - `fn`: The function to apply to each match. @@ -932,8 +848,6 @@ function to each. --- ### `matches` - -**Description:** Checks if the `Text` matches target [pattern](patterns.md) and returns an array of the matching text captures or a null value if the entire text doesn't match the pattern. @@ -943,8 +857,6 @@ the pattern. func matches(text: Text, pattern: Pattern -> [Text]) ``` -**Parameters:** - - `text`: The text to be searched. - `pattern`: The [pattern](patterns.md) to search for. @@ -964,8 +876,6 @@ or a null value otherwise. --- ### `quoted` - -**Description:** Formats the text as a quoted string. **Signature:** @@ -973,8 +883,6 @@ Formats the text as a quoted string. func quoted(text: Text, color: Bool = no -> Text) ``` -**Parameters:** - - `text`: The text to be quoted. - `color`: Whether to add color formatting (default is `no`). @@ -990,8 +898,6 @@ The text formatted as a quoted string. --- ### `repeat` - -**Description:** Repeat some text multiple times. **Signature:** @@ -999,8 +905,6 @@ Repeat some text multiple times. func repeat(text: Text, count:Int -> Text) ``` -**Parameters:** - - `text`: The text to repeat. - `count`: The number of times to repeat it. (Negative numbers are equivalent to zero). @@ -1016,8 +920,6 @@ The text repeated the given number of times. --- ### `replace` - -**Description:** Replaces occurrences of a [pattern](patterns.md) in the text with a replacement string. @@ -1026,8 +928,6 @@ string. func replace(text: Text, pattern: Pattern, replacement: Text, backref: Pattern = $/\/, recursive: Bool = yes -> Text) ``` -**Parameters:** - - `text`: The text in which to perform replacements. - `pattern`: The [pattern](patterns.md) to be replaced. - `replacement`: The text to replace the pattern with. @@ -1082,8 +982,6 @@ The text with occurrences of the pattern replaced. --- ### `replace_all` - -**Description:** Takes a table mapping [patterns](patterns.md) to replacement texts and performs all the replacements in the table on the whole text. At each position, the first matching pattern's replacement is applied and the pattern matching moves @@ -1096,8 +994,6 @@ behavior. func replace_all(replacements:{Pattern,Text}, backref: Pattern = $/\/, recursive: Bool = yes -> Text) ``` -**Parameters:** - - `text`: The text in which to perform replacements. - `replacements`: A table mapping from [pattern](patterns.md) to the replacement text associated with that pattern. @@ -1131,8 +1027,6 @@ replacement text. --- ### `reversed` - -**Description:** Return a text that has the grapheme clusters in reverse order. **Signature:** @@ -1140,8 +1034,6 @@ Return a text that has the grapheme clusters in reverse order. func reversed(text: Text -> Text) ``` -**Parameters:** - - `text`: The text to reverse. **Returns:** @@ -1156,8 +1048,6 @@ A reversed version of the text. --- ### `slice` - -**Description:** Get a slice of the text. **Signature:** @@ -1165,8 +1055,6 @@ Get a slice of the text. func slice(text: Text, from: Int = 1, to: Int = -1 -> Text) ``` -**Parameters:** - - `text`: The text to be sliced. - `from`: The index of the first grapheme cluster to include (1-indexed). - `to`: The index of the last grapheme cluster to include (1-indexed). @@ -1192,8 +1080,6 @@ the string. --- ### `split` - -**Description:** Splits the text into an array of substrings based on a [pattern](patterns.md). **Signature:** @@ -1201,8 +1087,6 @@ Splits the text into an array of substrings based on a [pattern](patterns.md). func split(text: Text, pattern: Pattern = "" -> [Text]) ``` -**Parameters:** - - `text`: The text to be split. - `pattern`: The [pattern](patterns.md) used to split the text. If the pattern is the empty string, the text will be split into individual grapheme clusters. @@ -1228,8 +1112,6 @@ An array of substrings resulting from the split. --- ### `starts_with` - -**Description:** Checks if the `Text` starts with a literal prefix text. **Signature:** @@ -1237,8 +1119,6 @@ Checks if the `Text` starts with a literal prefix text. func starts_with(text: Text, prefix: Text -> Bool) ``` -**Parameters:** - - `text`: The text to be searched. - `prefix`: The literal prefix text to check for. @@ -1254,8 +1134,6 @@ func starts_with(text: Text, prefix: Text -> Bool) --- ### `title` - -**Description:** Converts the text to title case (capitalizing the first letter of each word). **Signature:** @@ -1263,8 +1141,6 @@ Converts the text to title case (capitalizing the first letter of each word). func title(text: Text -> Text) ``` -**Parameters:** - - `text`: The text to be converted to title case. **Returns:** @@ -1279,8 +1155,6 @@ The text in title case. --- ### `to` - -**Description:** Get a slice of the text, ending at the given position. **Signature:** @@ -1288,8 +1162,6 @@ Get a slice of the text, ending at the given position. func to(text: Text, last: Int -> Text) ``` -**Parameters:** - - `text`: The text to be sliced. - `last`: The index of the last grapheme cluster to include (1-indexed). @@ -1311,8 +1183,6 @@ the string. --- ### `trim` - -**Description:** Trims the matching [pattern](patterns.md) from the left and/or right side of the text. **Signature:** @@ -1320,8 +1190,6 @@ Trims the matching [pattern](patterns.md) from the left and/or right side of the func trim(text: Text, pattern: Pattern = $/{whitespace/, trim_left: Bool = yes, trim_right: Bool = yes -> Text) ``` -**Parameters:** - - `text`: The text to be trimmed. - `pattern`: The [pattern](patterns.md) that will be trimmed away. - `trim_left`: Whether or not to trim from the front of the text. @@ -1345,8 +1213,6 @@ The text without the trim pattern at either end. --- ### `upper` - -**Description:** Converts all characters in the text to uppercase. **Signature:** @@ -1354,8 +1220,6 @@ Converts all characters in the text to uppercase. func upper(text: Text -> Text) ``` -**Parameters:** - - `text`: The text to be converted to uppercase. **Returns:** @@ -1370,8 +1234,6 @@ The uppercase version of the text. --- ### `utf32_codepoints` - -**Description:** Returns an array of Unicode code points for UTF32 encoding of the text. **Signature:** @@ -1379,8 +1241,6 @@ Returns an array of Unicode code points for UTF32 encoding of the text. func utf32_codepoints(text: Text -> [Int32]) ``` -**Parameters:** - - `text`: The text from which to extract Unicode code points. **Returns:** |
