/** * @test */ public function convertMoney() { $this->assertEquals('1000.10', Str::convertMoney('R$ 1.000,10')); $this->assertEquals('1000.10', Str::convertMoney('R$ 1000,10')); $this->assertEquals('1000.10', Str::convertMoney('1000,10')); $this->assertEquals('1000.10', Str::convertMoney('1.000,10')); $this->assertEquals(null, Str::convertMoney(null)); }
/** * Convert amount of money. * * @param mixed $amount * @param string|array $search * @param string|array $replace * * @return string|null */ function str_convert_money($amount, $search = ['.', ','], $replace = ['', '.']) { return Str::convertMoney($amount, $search, $replace); }