mysql 格式化数字入门实例
感兴趣的小伙伴,下面一起跟随编程之家 52php.cn的小编两巴掌来看看吧! 最近因为工作的需求,需要对mysql中数字进行格式化,但发现网上的资料较少,索性自己总结一下,方便自己也帮助有需要的朋友们,下面话不多说,来一起看看详细的介绍: 一、format函数:格式化浮点数 介绍:Formats the number X to a format like '#,###,###.##',rounded to D decimal places,and returns the result as a string. If D is 0,the result has no decimal point or fractional part. D should be a constant value. 示例代码
二、rpad 和 lpad 给定位数,不足补充自定义字符RPAD: Returns the string str,right-padded with the string padstr to a length of len characters. If str is longer than len,the return value is shortened to len characters. 示例代码
This function is multi-byte safe. LPAD: Returns the string str,left-padded with the string padstr to a length of lencharacters. If str is longer than len,the return value is shortened to lencharacters. 示例代码
(编辑:通辽站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |