如何将一个字符串中的所有非数字(0-9及小数点)字符全部除去_MySQL
May 10, 2018 pm 02:19 PM--如何将一个字符串中的所有非数字(0-9及小数点)字符全部除去 create function clear_num (@s nvarchar(100))--创建自定义函数 returns nvarchar(100) as begin while PATINDEX('%[^0-9.]%',@s)>=1 set @s=replace(@s,substring(@s,PATINDEX('%[^0-9.]%',@s),1),'')--使用replace(替换非数字字符为空字符串)、substring(确定被替换的字符)和patindex(确定非数字字符串的位置)三个函数 return(@s) end --使用 select dbo.clear_num('12qw34.as56zx')

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Detailed explanation of the method of converting int type to string in PHP

How to determine whether a Golang string ends with a specified character

How to check if a string starts with a specific character in Golang?

How to repeat a string in python_python repeating string tutorial

How to solve the problem of Chinese garbled characters when converting hexadecimal to string in PHP

PHP string manipulation: a practical way to effectively remove spaces

PHP String Matching Tips: Avoid Ambiguous Included Expressions

PHP techniques for deleting the last two characters of a string
