markdown compliant spaces

This commit is contained in:
Jon Lipstate
2023-03-27 22:20:24 -07:00
parent f5d66bcb6f
commit 7de67f8c1b
6 changed files with 302 additions and 302 deletions
+27 -27
View File
@@ -9,14 +9,14 @@ Converts invalid UTF-8 sequences in the input string `s` to the `replacement` st
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: Input string that may contain invalid UTF-8 sequences.
- replacement: String to replace invalid UTF-8 sequences with.
- allocator: (default: context.allocator).
WARNING: Allocation does not occur when len(s) == 0
**Returns** A valid UTF-8 string with invalid sequences replaced by `replacement`.
**Returns** A valid UTF-8 string with invalid sequences replaced by `replacement`.
*/
to_valid_utf8 :: proc(s, replacement: string, allocator := context.allocator) -> string {
if len(s) == 0 {
@@ -76,7 +76,7 @@ Converts the input string `s` to all lowercase characters.
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: Input string to be converted.
- allocator: (default: context.allocator).
@@ -93,7 +93,7 @@ Output:
test
**Returns** A new string with all characters converted to lowercase.
**Returns** A new string with all characters converted to lowercase.
*/
to_lower :: proc(s: string, allocator := context.allocator) -> string {
b: Builder
@@ -108,7 +108,7 @@ Converts the input string `s` to all uppercase characters.
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: Input string to be converted.
- allocator: (default: context.allocator).
@@ -125,7 +125,7 @@ Output:
TEST
**Returns** A new string with all characters converted to uppercase.
**Returns** A new string with all characters converted to uppercase.
*/
to_upper :: proc(s: string, allocator := context.allocator) -> string {
b: Builder
@@ -138,10 +138,10 @@ to_upper :: proc(s: string, allocator := context.allocator) -> string {
/*
Checks if the rune `c` is a delimiter (' ', '-', or '_').
**Inputs**
**Inputs**
- c: Rune to check for delimiter status.
**Returns** True if `c` is a delimiter, false otherwise.
**Returns** True if `c` is a delimiter, false otherwise.
*/
is_delimiter :: proc(c: rune) -> bool {
return c == '-' || c == '_' || is_space(c)
@@ -149,10 +149,10 @@ is_delimiter :: proc(c: rune) -> bool {
/*
Checks if the rune `r` is a non-alphanumeric or space character.
**Inputs**
**Inputs**
- r: Rune to check for separator status.
**Returns** True if `r` is a non-alpha or `unicode.is_space` rune.
**Returns** True if `r` is a non-alpha or `unicode.is_space` rune.
*/
is_separator :: proc(r: rune) -> bool {
if r <= 0x7f {
@@ -179,7 +179,7 @@ is_separator :: proc(r: rune) -> bool {
/*
Iterates over a string, calling a callback for each rune with the previous, current, and next runes as arguments.
**Inputs**
**Inputs**
- w: An io.Writer to be used by the callback for writing output.
- s: The input string to be iterated over.
- callback: A procedure to be called for each rune in the string, with arguments (w: io.Writer, prev, curr, next: rune).
@@ -241,11 +241,11 @@ Converts the input string `s` to "lowerCamelCase".
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: Input string to be converted.
- allocator: (default: context.allocator).
**Returns** A "lowerCamelCase" formatted string.
**Returns** A "lowerCamelCase" formatted string.
*/
to_camel_case :: proc(s: string, allocator := context.allocator) -> string {
s := s
@@ -275,11 +275,11 @@ Converts the input string `s` to "UpperCamelCase" (PascalCase).
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: Input string to be converted.
- allocator: (default: context.allocator).
**Returns** A "PascalCase" formatted string.
**Returns** A "PascalCase" formatted string.
*/
to_pascal_case :: proc(s: string, allocator := context.allocator) -> string {
s := s
@@ -307,7 +307,7 @@ Returns a string converted to a delimiter-separated case with configurable casin
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: The input string to be converted
- delimiter: The rune to be used as the delimiter between words
- all_upper_case: A boolean indicating if the output should be all uppercased (true) or lowercased (false)
@@ -330,7 +330,7 @@ Output:
HELLO WORLD
a_b_c
**Returns** The converted string
**Returns** The converted string
*/
to_delimiter_case :: proc(
s: string,
@@ -380,7 +380,7 @@ Converts a string to "snake_case" with all runes lowercased
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: The input string to be converted
- allocator: (default: context.allocator).
@@ -400,7 +400,7 @@ Output:
hello_world
```
**Returns** The converted string
**Returns** The converted string
*/
to_snake_case :: proc(s: string, allocator := context.allocator) -> string {
return to_delimiter_case(s, '_', false, allocator)
@@ -412,7 +412,7 @@ Converts a string to "SNAKE_CASE" with all runes uppercased
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: The input string to be converted
- allocator: (default: context.allocator).
@@ -429,7 +429,7 @@ Output:
HELLO_WORLD
**Returns** The converted string
**Returns** The converted string
*/
to_upper_snake_case :: proc(s: string, allocator := context.allocator) -> string {
return to_delimiter_case(s, '_', true, allocator)
@@ -439,7 +439,7 @@ Converts a string to "kebab-case" with all runes lowercased
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: The input string to be converted
- allocator: (default: context.allocator).
@@ -456,7 +456,7 @@ Output:
hello-world
**Returns** The converted string
**Returns** The converted string
*/
to_kebab_case :: proc(s: string, allocator := context.allocator) -> string {
return to_delimiter_case(s, '-', false, allocator)
@@ -466,7 +466,7 @@ Converts a string to "KEBAB-CASE" with all runes uppercased
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: The input string to be converted
- allocator: (default: context.allocator).
@@ -483,7 +483,7 @@ Output:
HELLO-WORLD
**Returns** The converted string
**Returns** The converted string
*/
to_upper_kebab_case :: proc(s: string, allocator := context.allocator) -> string {
return to_delimiter_case(s, '-', true, allocator)
@@ -493,7 +493,7 @@ Converts a string to "Ada_Case"
*Allocates Using Provided Allocator*
**Inputs**
**Inputs**
- s: The input string to be converted
- allocator: (default: context.allocator).
@@ -510,7 +510,7 @@ Output:
Hello_World
**Returns** The converted string
**Returns** The converted string
*/
to_ada_case :: proc(s: string, allocator := context.allocator) -> string {
s := s