Add NumberFormatter helper class for number formatting

- Introduced a new helper class `NumberFormatter` with a method `commaToDot` to convert numbers formatted with commas to a dot notation.
- The method also trims whitespace and removes percentage signs for cleaner data handling.

This commit enhances the application's ability to process numerical data consistently, supporting future financial data operations.
This commit is contained in:
Ümit Tunç
2025-01-17 23:06:55 +03:00
parent 25327ac0cc
commit 6b5270f341
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Helpers;
class NumberFormatter
{
public static function commaToDot($text)
{
$text = trim($text);
$text = str_replace(".", "", $text);
$text = str_replace(",", ".", $text);
$text = str_replace("%", "", $text);
return $text;
}
}