str='123\u00A0456\u00A0789.123';
console.log( str + ' : ' + mkCleanNumber( str ) );
str='123 456 789.123'
console.log( str + ' : ' + mkCleanNumber( str ) );
str='123 456 789.123';
console.log( str + ' : ' + mkCleanNumber( str ) );
function mkCleanNumber( s ) {
return parseFloat(
s.replace( /&#[0-9a-fx]*;/ig, '' ).replace( /[^0-9.]/g, '' )
);
}
function mkCleanNumber( s ) {
return parseFloat(
s.replace( /&#[0-9a-fx]*;/ig, '' ).replace( /[^0-9.]/g, '' )
);
}
Ausgaben:
123 456 789.123 : 123456789.123
123 456 789.123 : 123456789.123
123 456 789.123 : 123456789.123