Cause of the problem:
Project environment php+oracle, if the data taken out from oracle is a number less than 1, the result will be 0, such as: '0.8', and the result will be displayed on the page It becomes '.8'. After reading Oracle's tutorial, I found that the solution is to_char before taking the value. However, because there are too many fields, it is very troublesome to do this. I plan to replace it with regular expression.
Example:
.5=>0.5
.03=>0.03
業(yè)精于勤,荒于嬉;行成于思,毀于隨。
$number = '.5';
$number = preg_replace('/^(\.\d+)/', '0$1', $number);
echo $number;
$num = ".8";
$res = preg_replace('/^.(d+)/', '0.${1}', $num);
The obtained $res is just
reg = /^\./;
var arr = ['.5', '.03', '4']
for (let i = 0, len = arr.length; i < len; i++) {
console.log(arr[i], arr[i].replace(reg,'0.'))
}