Difference between revisions of "Ftos"
Jump to navigation
Jump to search
(Created page with "ftos is a quake-c function which converts a single floating point to a string (thus the contracted name f-to-s). It is one of very few string methods in vanilla quake c") |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
ftos is a quake-c function which converts a single floating point to a string (thus the contracted name f-to-s). | ftos is a quake-c function which converts a single [[Float|floating point]] to a [[Quake c string|string]] (thus the contracted name f-to-s). | ||
It is one of very few string methods in vanilla quake c | It is one of very few string methods in vanilla quake c | ||
There are lots of different needs when turning numbers into strings. ftos has quirks most especially that it doesn't always produce a string containing only numbers. | |||
{| class="wikitable" | |||
|+ | |||
!function call | |||
!string output | |||
!string length | |||
|- | |||
|ftos(3) | |||
|"3" | |||
|1 | |||
|- | |||
|ftos(3.0) | |||
|"3" | |||
|1 | |||
|- | |||
|ftos(3.1) | |||
|" 3.1" | |||
|5 | |||
|- | |||
|ftos(23.1) | |||
|" 23.1" | |||
|5 | |||
|- | |||
|ftos(123.1) | |||
|"123.1" | |||
|5 | |||
|- | |||
|ftos(1234.1) | |||
|"1234.1" | |||
|6 | |||
|} | |||
[[Category:Quake-C Builtins]] |
Latest revision as of 08:27, 17 February 2022
ftos is a quake-c function which converts a single floating point to a string (thus the contracted name f-to-s).
It is one of very few string methods in vanilla quake c
There are lots of different needs when turning numbers into strings. ftos has quirks most especially that it doesn't always produce a string containing only numbers.
function call | string output | string length |
---|---|---|
ftos(3) | "3" | 1 |
ftos(3.0) | "3" | 1 |
ftos(3.1) | " 3.1" | 5 |
ftos(23.1) | " 23.1" | 5 |
ftos(123.1) | "123.1" | 5 |
ftos(1234.1) | "1234.1" | 6 |