oaspec/util/string_extra

Types

Values

pub fn blank_line(
  sb: string_tree.StringTree,
) -> string_tree.StringTree

Append a blank line.

pub fn doc_comment(
  sb: string_tree.StringTree,
  text: String,
) -> string_tree.StringTree

Wrap a string in Gleam doc comment style.

pub fn doc_comment_indented(
  sb: string_tree.StringTree,
  level: Int,
  text: String,
) -> string_tree.StringTree

Wrap a string in Gleam doc comment style with indentation.

pub fn file_header(version: String) -> string_tree.StringTree

Generate a file header with auto-generation notice.

pub fn imports(
  sb: string_tree.StringTree,
  modules: List(String),
) -> string_tree.StringTree

Generate import statements.

pub fn indent(
  sb: string_tree.StringTree,
  level: Int,
  text: String,
) -> string_tree.StringTree

Append an indented line to the string builder.

pub fn join_with(
  items: List(String),
  separator: String,
) -> String

Join a list of strings with a separator.

pub fn line(
  sb: string_tree.StringTree,
  text: String,
) -> string_tree.StringTree

Append a line to the string builder.

pub fn new() -> string_tree.StringTree

Create a new empty string builder.

pub fn repeat_char(char: String, n: Int) -> String

Repeat a character n times

pub fn to_string(sb: string_tree.StringTree) -> String

Convert the string builder to a final string.

Search Document