format


Description:

[ CCode ( cname = "g_ascii_formatd" , instance_pos = -1 ) ]
public unowned string format (char[] buffer, string format = "%g")

Converts a double to a string, using the '.

' as decimal point. To format the number you pass in a printf-style format string. Allowed conversion specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.

The format must just be a single format specifier starting with `%`, expecting a double argument.

The returned buffer is guaranteed to be nul-terminated.

If you just want to want to serialize the value into a string, use to_str.

Parameters:

buffer

A buffer to place the resulting string in

format

The printf-style format to use for the code to use for converting

buf_len

The length of the buffer.

d

The double to convert

Returns:

The pointer to the buffer with the converted string.




2022 vala-language.org