concat()

函数
收藏
0有用+1
0
concat ()方法用于连接两个或多个数组。
该方法不会改变现有的数组,而仅仅会返回被连接数组的一个副本。
返回一个新的数组。该数组是通过把所有 arrayX 参数添加到 arrayObject 中生成的。如果要进行 concat 操作的参数是数组,那么添加的是数组中的元素,而不是数组。
中文名
连接两个或多个数组
外文名
concat
特    点
不会改变现有的数组
性    质
返回一个新的数组

函数

播报
编辑

使用方法

谅晚凝注宙喇弃埋慨虹杠意:
如果所有参数均为非二进制字符串,则结果为非二进制字符串。
如果自变量中含有任一二进制字符串,则结果为一个二进制字符串。
一个数字参数被转化为与之相等的二进制字符串格式;若要避免这种情况,可使用显式类型 cast, 例如:
SELECT CONCAT(CAST(int_col AS CHAR), 习旬朵char_col)
oracle的concat函数只能连接一至两个字符,如需要连接多个字符需要嵌套使用,如
例子趋体料:
select concat('11') from dual; ----连接符直接形式展现
返回棕己蜜喇:'11'
select concat('11','22') from dual; ----链接两个字段
返回:'112元凶才2'
select concat(concat('11','22'),'33') from dual; ----链接三个字段
返回:'112233'
select concat(concat('11',null),'33') from dual; ----如果有null则返回null
返回:null

定义用法

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。
这个方法不会改变现存的数组,它只返回了所结合数组的一份拷贝。
Oracle数据库中,可以使用||代替concat(),并且||可以同时连接多个字符串。
在Sqlserver数据库中,可以使用+代替concat(),+也可以同时连接多个字符串。

浏览器支持

播报
编辑
所有主要浏览器都支持concat()。

参数 Values

播报
编辑
参数
描述
array2,array3, ...,arrayX
必需。该参数可以是具体的值,也可以是数组对象。可以是任意多个。

语法

播报
编辑

举例 1

Here we create two arrays and show them as one using concat():
这里我们使用了concat()将两个数组结合成了一个:
The output of the code above will be:
上面代码的输出结果为:

举例 2

Here we create three arrays and show them as one using concat():
我们通过使用concat()将三个数组结合成为了一个数组
The output of the code above will be:
上面代码的结果为:

举例 3

var stringValue = "Hello "; var result =stringValue.concat("world"); alert(result);//"Hello world" alert(stringValue);//"Hello "