当前位置:网站首页>JS string combination
JS string combination
2022-06-12 10:20:00 【Qu Shuai 369】
Note that the data types should be consistent
// add to
function strAdd(str1, str2){
if(str1 == null || str1 == '')
return str2;
if(str2 == null || str2 =='')
return str1;
var ary = str1.split(",");
ary.push(str2);
return ary.join(",");
}
// Delete
function strDel(str1, str2){
if(str1 == null || str1 == '')
return "";
if(str2 == null || str2 == '')
return str1;
var ary = str1.split(",");
var index = ary.indexOf(str2);
if (index > -1) {
ary.splice(index, 1);
}
return ary.join(",");
}
边栏推荐
- CLAHE in opencv for 16 bit image enhancement display
- PostgreSQL uses stored procedures to splice multiple tables and query data
- Redis (II) Memory mapped data structure
- 在线电路仿真以及开源电子硬件设计介绍
- [926. flip the string to monotonic increment]
- 3. Abstract Factory
- 【系统分析师之路】第十八章 复盘系统安全分析与设计
- FPGA基于DE2-115平台的VGA显示
- 极速搭建元宇宙画廊 #oncyber.io
- tp6调试(trace)
猜你喜欢

Win10 professional edition user name modification

Redis (I) Internal data structure

在线电路仿真以及开源电子硬件设计介绍
![[926. flip the string to monotonic increment]](/img/fa/1838405693aa0998694d4895a611c2.png)
[926. flip the string to monotonic increment]
![[MySQL] index invalidation and index optimization](/img/af/9ed540aab764f4962ccc9bbfe406f3.jpg)
[MySQL] index invalidation and index optimization

【实验】MySQL主从复制及读写分离
![[DDS] ddsi-rtps specification](/img/fe/16b835e3e4a8ff71ab3dbc4b9c4d2a.jpg)
[DDS] ddsi-rtps specification

FPGA VGA display based on de2-115 platform

MySQL III Configuration file & log file

1268_FreeRTOS任务上下文切换的实现
随机推荐
string类对象的访问及遍历操作
[path of system analyst] Chapter 18 security analysis and design of double disk system
【系统分析师之路】第十八章 复盘系统安全分析与设计
【926. 将字符串翻转到单调递增】
How PLC constructs shift function block (FC) by itself
Class selectors and using pseudo class selectors with
3. Abstract Factory
Getting started with cloud API basics -- basic knowledge of picgo writing plug-ins
MySQL VI Database lock
看看你有没有陷入“标签化”客户和 用户 的陷阱?
古董级MFC/GDI+框架LCD显示控件
[Wayland] Wayland introduction and customized guidance
2021-09-13
Shen Min, CIO of science and technology innovator Digital China Group: the best practice model is failing, and open source accelerates Distributed Innovation
Redis (II) Memory mapped data structure
C language recursive folder code
2022淘宝618超级喵运会怎么玩?2022淘宝618喵运会玩法技巧
Yarn scheduling
2021-01-13
Propagation of transactions