Added a method to replace every ',' in a string with a '.'.
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user