Added a method to replace every ',' in a string with a '.'.

This commit is contained in:
Lukas Halbritter
2018-10-04 20:32:46 +02:00
parent bfe50dec65
commit 201ffd3d7a
+11
View File
@@ -52,6 +52,17 @@ function formatAmount(float $amount, $cash = true, $text = false,
return number_format(abs($amount), $decimals, ',', '.') . $euro;
}
/**
* Replace all commas in a string by a dot. This can be useful to convert
* strings that represent a float and use a comma as decimal point to a string
* of the same float but with a dot as decimal point.
*
* @return string
*/
function swapComma(string $floatString) {
return str_replace(',', '.', $floatString);
}
/**
* Return a formatted date string.
*