Std.Show
View source →The Show protocol: convert values to their human-readable
String form.
This is the counterpart of Elixir's String.Chars / Inspect
split: show/1 produces a representation suitable for
debugging and log output. Strings are wrapped in quotes, atoms
are prefixed with :; callers that want raw text should use
Std.String.from_* instead.
Examples
use Std.Show
show(42) # => "42"
show("hi") # => "\"hi\""
show(:ok) # => ":ok"
show_line(true) # => "true\n"
Protocols
-
proto Show(T)Convert a value of any
Show-able type to its string representation.
Functions
-
# fn __group__() -> Atom
Group tag consumed by
Cure.Stdlib.Preload. -
# fn show(x: Int) -> String
Render an integer as decimal digits.
-
# fn show(x: Float) -> String
Render a float as a decimal string.
-
# fn show(x: String) -> String
Render a string with surrounding quotes; does not escape.
-
# fn show(x: Bool) -> String
Render a boolean as the literal words
trueorfalse. -
# fn show(x: Atom) -> String
Render an atom as
":" <> name. -
# fn show_line(x: T) -> String
Same as
show/1but append a trailing newline. Useful for logging.