diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-15 12:33:52 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-02-15 12:33:52 +0100 |
commit | bcdce9633dc351d3bc7f347a165348b8fab87cd9 (patch) | |
tree | 88c2f5d8f0c5fac2bca28e4b543e5209f3bc98fb /src/std/conversion.hpp | |
parent | 917adc6a2b6b166e37fc3d4f94b41488f0c245a5 (diff) |
refactor: reorganize files & improve classes
Diffstat (limited to 'src/std/conversion.hpp')
-rw-r--r-- | src/std/conversion.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/std/conversion.hpp b/src/std/conversion.hpp new file mode 100644 index 0000000..726ce88 --- /dev/null +++ b/src/std/conversion.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include "std/memory.hpp" +#include "std/smart_string.hpp" + +/** + * Converts a double number to a string. + * + * @param num A double number + * @param width The desired double width + * @param precision The desired double precision + * @returns The double as a string. + */ +UniquePtr<SmartString> doubleToStr(double num, unsigned int width = 3, + unsigned int precision = 2); + +/** + * Converts a integer to a string. + * + * @param num A number + * @returns The number as a string. + */ +UniquePtr<SmartString> intToStr(int num); + +/** + * Converts a unsigned integer to a string. + * + * @param num A number + * @returns The number as a string. + */ +UniquePtr<SmartString> uintToStr(unsigned int num); |