0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 14:48:03 +03:00

trim away trailing zeros compile option

This commit is contained in:
OneOfEleven
2023-10-23 11:46:51 +01:00
parent 0d36e997d4
commit 74f52f9d14
7 changed files with 52 additions and 21 deletions

10
misc.c
View File

@ -341,3 +341,13 @@ int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit,
return Base;
}
void NUMBER_trim_trailing_zeros(char *str)
{
if (str != NULL)
{
int i = (int)strlen(str) - 1;
while (i > 0 && (str[i] == '0' || str[i] == ' ') && str[i - 1] != '.')
str[i--] = 0;
}
}