QuakeServer.Extensions.Format (quake_server v0.1.0)

Copy Markdown View Source

QuakeC's sprintf: C's conversions over the builtin's arguments.

QuakeServer.Extensions.Format.sprintf(host, "%s has %d health", 1, argc)

Conversions: d and i whole numbers, u unsigned, x and X hexadecimal, o octal, c a character code, e, E, f, F, g and G floats, s text, S text in quotes, v a vector, p a pointer, %% a percent sign. Flags -, 0, +, space and #, a width and a precision (either may be *, taken from the next argument) and the size prefixes l, h and ll are accepted; the size prefixes change nothing, as every argument is read for what it holds.

Summary

Functions

A float as C's %f, %e or %g writes it, precision places.

Format format with the arguments from number first up to argc.

Functions

float(value, conversion, precision, flags \\ [])

@spec float(number(), char(), non_neg_integer(), [char()]) :: String.t()

A float as C's %f, %e or %g writes it, precision places.

sprintf(host, format, first, argc)

@spec sprintf(map(), String.t(), non_neg_integer(), non_neg_integer()) :: String.t()

Format format with the arguments from number first up to argc.