Next: , Previous: , Up: API  


1.6 (kracht strings)

1.6.1 Procedures

Procedure: base64-decode s

Decode a base64 encoded string S back into its raw UTF-8 string format. Whitespace and newlines in S are ignored. For backwards compatibility with the previous shell-based implementation, trailing whitespace is trimmed from the decoded output.

Procedure: base64-encode s

Encode string S into a base64 string without line wrapping. This is implemented in pure Scheme, so it does not require the ‘base64‘ binary to be in PATH and it cannot be broken by S containing a line that happens to look like a shell heredoc terminator.

Procedure: empty-string? s

Return #t if S is exactly the empty string "".

Procedure: non-empty-string? s

Return #t if S is a string with at least one character, otherwise #f. Note that any non-string value (including #t and numbers) returns #f.

Procedure: string->utf8 _

Undocumented procedure.

Procedure: string-drop-first-last s

Return a substring of S with its first and last characters removed. If the string length is 2 or less, returns S unaltered.

Procedure: string-drop-first-last-line s

Split string S by newlines, remove its first and last lines, and rejoin the remaining lines with newlines.

Procedure: string-drop-first-last-n s n

Return a substring of S with the first N characters and the final 1 character removed. If the string length is 2 or less, returns S unaltered. N is clamped to the valid range, so N is never allowed to drop the whole string or to raise an error.

Procedure: string-replace-substring str substring replacement

Return a new string where every instance of substring in string str has been replaced by replacement. For example:

(string-replace-substring "a ring of strings" "ring" "rut")
⇒ "a rut of struts"
Procedure: utf8->string _

Undocumented procedure.


Next: (kracht web), Previous: (kracht sql), Up: API