htmlToPrice ( string html , int _nbOfDecimal ) : float

Return a price (float) in a html code. If there is no digit, it returns null.
Attention, this function is able to get a price out of a "dirty text", but some elements can disturb its functioning. For example, in the expression "30,98 € by Ltr.", the dot after Ltr makes the decimal separator is "." so you have to clean up the expression before the htmlToPrice. In general, try to isolate the price as much as possible before using this function.


console(htmlToPrice('<div class="price"><h3>$33.58856</h3><div>')) //-> 33.5885691
console(htmlToPrice('<div class="price"><h3>$EE.S</h3><div>')) //-> NULL



Html code which contains the price.

_nbOfDecimal (optional)

Number of decimal you need in your price.