.net 拆分字符串成数数组 包含使用空格 逗号 回车 换行符等
2024-08-24 14:41:03
简单的代码如下:
public static string[] GetProductList(string inputstring)
{
char[] split = { ',', ' ', ';', ';', ',', ':', ':', (char)10, (char)13 };
return inputstring.Split(split, StringSplitOptions.RemoveEmptyEntries);
}
获取sql in 部分的代码:
public static string GetSQLInPartByProductlist(string[] productlist)
{
string inpartsql = " in (";
string endpart = ")";
foreach (string item in productlist)
{
inpartsql += "'" + item + "'," + " ";
}
inpartsql = inpartsql.Remove(inpartsql.Length - 2);
inpartsql += endpart;
return inpartsql;
}
测试的界面
最新文章
- 智能指针unique_ptr的用法
- Hello 2017!
- js调用浏览器打印
- windows 文件权限导致的 git 问题
- String类和StringBuffer类的方法
- mvc无法找到资源
- jquery 操作 checkbox
- 自制获取data-自定义属性
- Cows(poj 2481 树状数组)
- 段(SEGMENT)
- shell 中test命令
- 【Python使用】使用pip安装卸载Python包(含离线安装Python包)未完成???
- [20170628]完善ooerr脚本.txt
- ]remove-duplicates-from-sorted-list-ii (删除)
- mysql数据库建立的数据库在哪个文件夹?
- python复习冒泡排序
- linux dns
- 使用React改版网站
- 回调函数callback使用例子
- java强软弱虚引用详解(转载)