sql server_sql substr()函数用法详细

更新时间:2017-05-30    来源:php函数    手机版     字体:

【www.bbyears.com--php函数】

语法

 代码如下

substr( string, start_position, [ length ] )


字符串是源字符串。

start_position是提取的位置。字符串中的第一个位置始终为1。

length  可选的。它是提取的字符数。如果省略该参数,SUBSTR将返回整个字符串。

Applies To:

 代码如下

Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g


实例

 代码如下

substr("This is a test", 6, 2) would return "is"
substr("This is a test", 6) would return "is a test"
substr("TechOnTheNet", 1, 4) would return "Tech"
substr("TechOnTheNet", -3, 3) would return "Net"
substr("TechOnTheNet", -6, 3) would return "The"
substr("TechOnTheNet", -8, 2) would return "On"

本文来源:http://www.bbyears.com/jiaocheng/33015.html