词条 | concat |
释义 | MySQL中concat函数 使用方法: CONCAT(str1,str2,…) 返回结果为连接参数产生的字符串。如有任何一个参数为NULL ,则返回值为 NULL。 注意: 如果所有参数均为非二进制字符串,则结果为非二进制字符串。 如果自变量中含有任一二进制字符串,则结果为一个二进制字符串。 一个数字参数被转化为与之相等的二进制字符串格式;若要避免这种情况,可使用显式类型 cast, 例如: SELECT CONCAT(CAST(int_col AS CHAR), char_col) MySQL的concat函数可以连接一个或者多个字符串,如 mysql> select concat('10'); +--------------+ | concat('10') | +--------------+ | 10 | +--------------+ 1 row in set (0.00 sec) mysql> select concat('11','22','33'); +------------------------+ | concat('11','22','33') | +------------------------+ | 112233 | +------------------------+ 1 row in set (0.00 sec) MySQL的concat函数在连接字符串的时候,只要其中一个是NULL,那么将返回NULL mysql> select concat('11','22',null); +------------------------+ | concat('11','22',null) | +------------------------+ | NULL | +------------------------+ 1 row in set (0.00 sec) JavaScript concat() 方法 Definition and Usage定义与用法The concat() method is used to join two or more arrays. 使用concat()方法可用来将两个或多个数组结合起来 This method does not change the existing arrays, it only returns a copy of the joined arrays. 这个方法不会改变现存的数组,它只返回了所结合数组的一份拷贝。 Syntax 语法arrayObject.concat(arrayX,arrayX,......,arrayX) Parameter arrayX Required. One or more array objects to be joined to an array 举例 1Here we create two arrays and show them as one using concat(): 这里我们使用了concat()将两个数组结合成了一个: <script type="text/javascript"> 上面代码的输出结果为: Jani,Tove,Hege,John,Andy,Wendy 举例 2Here we create three arrays and show them as one using concat(): 我们通过使用concat()将三个数组结合成为了一个数组: <script type="text/javascript"> 上面代码的结果为: Jani,Tove,Hege,John,Andy,Wendy,Stale,Borge |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。