mastercut/app/Helpers/string_helpers.php

27 lines
584 B
PHP
Executable File

<?php
if (! function_exists('removeRupiahFormatting')) {
function removeRupiahFormatting($value)
{
$convertedValue = str_replace(['Rp', '.', ' '], '', $value);
$convertedValue = str_replace(',', '.', $convertedValue);
return $convertedValue;
}
}
if (! function_exists('formatToRupiah')) {
function formatToRupiah($value)
{
return 'Rp'.number_format($value, 0, ',', '.');
}
}
if (! function_exists('decimalToInteger')) {
function decimalToInteger($value)
{
return number_format($value, 0, ',', '.');
}
}