C# Split 根据组合字符进行拆分数组用法

C# Split 根据组合字符进行拆分数组用法,如下代码:

string sql = "aaaaaaaaaa{@}bbbbbbbbbb{@}ccccccc#cccccc";
//1、单组合{@}拆分
string[] separator = new string[] { "{@}" };
//2、多组合{@}、#拆分
string[] separator1 = new string[] { "{@}", "#" };
string[] arry = sql.Split(separator, StringSplitOptions.RemoveEmptyEntries);
string[] newArry = sql.Split(new string[] { "{-<@>-}" }, StringSplitOptions.RemoveEmptyEntries);
时间: 2024-09-24 12:08:09

C# Split 根据组合字符进行拆分数组用法的相关文章

php分割字符串并输出数组字符例子

  在php中分割字符函数可以使用explode()函数,但是使用此函数必须要有一个规律了,如以|分开或以其它字符分开,这样我们就可以直接使用explode把字符串分成数组之后再利用for遍历输出,下面来看几个例子. explode() 函数把字符串分割为数组. 语法 explode(separator,string,limit) 例子一  代码如下   <?php $test='472347127,893372115,850965403'; $r=explode(",",$te

[LeetCode] Split Array into Consecutive Subsequences 将数组分割成连续子序列

You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split. Example

c语言-关于字符型指针数组的理解问题

问题描述 关于字符型指针数组的理解问题 #include<stdio.h> main() { char *name[]={"zhang","gou","xu","zheng","mao","zhao","li","bai","qing"}; printf("%s ",*name[1]); } 此时

字符串-这个bug在哪里,如何为字符型指针数组赋值呢?

问题描述 这个bug在哪里,如何为字符型指针数组赋值呢? 程序如下: #include<stdio.h> #include<string.h> main() { char *a[2]; char *d; printf("请输入两个字符串:"); scanf("%s%s",a[0],a[1]); if(strcmp(a[0],a[1])>0) {d=a[0];a[0]=a[1];a[1]=d;} printf("%s "

[LeetCode] Split Linked List in Parts 拆分链表成部分

Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts". The length of each part should be as equal as possible: no two parts should have a size differing by more than 1.

jquery中map函数遍历数组用法实例

  本文实例讲述了jquery中map函数遍历数组用法.分享给大家供大家参考.具体如下: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "

Python映射拆分操作符用法实例

  本文实例讲述了Python映射拆分操作符用法.分享给大家供大家参考.具体如下: ? 1 2 3 4 name="jack" age=24 s="name is {name} and age is {age}".format(**locals()) print s 运行结果如下: name is jack and age is 24 希望本文所述对大家的Python程序设计有所帮助.

PHP入门教程之数组用法汇总(创建,删除,遍历,排序等)_php技巧

本文实例总结了PHP数组用法.分享给大家供大家参考,具体如下: Demo1.php <?php //创建一个数组变量 $userNames = array('张三','李四','王五'); //将这个数组打印出来 // echo $userNames;//Array // $userName = '张三'; // echo $userName;//张三 //如果你想打印出这个数组的某一个元素 //那你必须找到这个元素的下标,键(key) //0,1,2 //echo $userNames[2];

jquery中map函数遍历数组用法实例_jquery

本文实例讲述了jquery中map函数遍历数组用法.分享给大家供大家参考.具体如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <