29 个解决方案
#1
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
#2
up
#3
试下
#4
#5
string ss = s.Substring(0, 5);
string st = s.Remove(0, 5);
string st = s.Remove(0, 5);
#6
正确
5楼的不行
或者是用indexof获取rev的位置,然后substring(i,l)
#7
easy
#8
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
#9
关于字符串及数组转换,详见
http://blog.csdn.net/simonezhlx/archive/2008/10/17/3091956.aspx
http://blog.csdn.net/simonezhlx/archive/2008/10/17/3091956.aspx
#10
用split函数。
#11
楼主结贴吧
#12
C# code
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
代码分析:
s=“xxxxxxREVxxxxx”
s=“xxxxxREVREVxxxxx”
s=“xxxxxxREVxxxxxxDREV”
s=“REVxxxxxREVxxxxxDREV”
s=“REVxxxxxREVxxxxREVxxxxx”
s=“REVxxxxxrevxxxxREVxxxxx”
请自己测试去,
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
代码分析:
s=“xxxxxxREVxxxxx”
s=“xxxxxREVREVxxxxx”
s=“xxxxxxREVxxxxxxDREV”
s=“REVxxxxxREVxxxxxDREV”
s=“REVxxxxxREVxxxxREVxxxxx”
s=“REVxxxxxrevxxxxREVxxxxx”
请自己测试去,
#13
up
#14
方法说的差不多了,帮你顶吧,来晚喽
#15
学习啦
#16
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
结果:
ss[0]="asasd";
ss[1]="2315D";
#17
正则表达式!!
#18
如楼上所述,将"REV"视为分隔符即可
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
#19
楼上各位,搂主是不是已经确定字符串中只有一个“REV”?
如果是:asasdREVREV5D该如何?
如果是:asasdREVREV5D该如何?
#20
楼主要的结果中后一个字符串是要带REV的
string[] result = System.Text.RegularExpressions.Regex.Split("asasdREV2315D", @"(?=REV)");
foreach (string s in result)
{
richTextBox1.Text += s + "\n";
}
#21
试了代码:不错啊,有学习了一招
#22
... ... 这个,这个 ... ...
#23
显然错误...
original:asasdREV2315D
result:asasd
2315D
曲解了红色部分枚举值的含义...
Root_正解.
#24
This example demonstrates the String() methods that use
// the StringSplitOptions enumeration.
using System;
class Sample
{
public static void Main()
{
string s1 = " ,ONE,,TWO,,,THREE,,";
string s2 = "[stop]" +
"ONE[stop][stop]" +
"TWO[stop][stop][stop]" +
"THREE[stop][stop]";
char[] charSeparators = new char[] {' ,'};
string[] stringSeparators = new string[] {"[stop]"};
string[] result;
// ------------------------------------------------------------------------------
// Split a string delimited by characters.
// ------------------------------------------------------------------------------
Console.WriteLine("1) Split a string delimited by characters:\n");
// Display the original string and delimiter characters.
Console.WriteLine("1a )The original string is \"{0}\".", s1);
Console.WriteLine("The delimiter character is '{0}'.\n",
charSeparators[0]);
// Split a string delimited by characters and return all elements.
Console.WriteLine("1b) Split a string delimited by characters and " +
"return all elements:");
result = s1.Split(charSeparators, StringSplitOptions.None);
Show(result);
// Split a string delimited by characters and return all non-empty elements.
Console.WriteLine("1c) Split a string delimited by characters and " +
"return all non-empty elements:");
result = s1.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// Split the original string into the string and empty string before the
// delimiter and the remainder of the original string after the delimiter.
Console.WriteLine("1d) Split a string delimited by characters and " +
"return 2 elements:");
result = s1.Split(charSeparators, 2, StringSplitOptions.None);
Show(result);
// Split the original string into the string after the delimiter and the
// remainder of the original string after the delimiter.
Console.WriteLine("1e) Split a string delimited by characters and " +
"return 2 non-empty elements:");
result = s1.Split(charSeparators, 2, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// ------------------------------------------------------------------------------
// Split a string delimited by another string.
// ------------------------------------------------------------------------------
Console.WriteLine("2) Split a string delimited by another string:\n");
// Display the original string and delimiter string.
Console.WriteLine("2a) The original string is \"{0}\".", s2);
Console.WriteLine("The delimiter string is \"{0}\".\n", stringSeparators[0]);
// Split a string delimited by another string and return all elements.
Console.WriteLine("2b) Split a string delimited by another string and " +
"return all elements:");
result = s2.Split(stringSeparators, StringSplitOptions.None);
Show(result);
// Split the original string at the delimiter and return all non-empty elements.
Console.WriteLine("2c) Split a string delimited by another string and " +
"return all non-empty elements:");
result = s2.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// Split the original string into the empty string before the
// delimiter and the remainder of the original string after the delimiter.
Console.WriteLine("2d) Split a string delimited by another string and " +
"return 2 elements:");
result = s2.Split(stringSeparators, 2, StringSplitOptions.None);
Show(result);
// Split the original string into the string after the delimiter and the
// remainder of the original string after the delimiter.
Console.WriteLine("2e) Split a string delimited by another string and " +
"return 2 non-empty elements:");
result = s2.Split(stringSeparators, 2, StringSplitOptions.RemoveEmptyEntries);
Show(result);
}
// Display the array of separated strings.
public static void Show(string[] entries)
{
Console.WriteLine("The return value contains these {0} elements:", entries.Length);
foreach (string entry in entries)
{
Console.Write("<{0}>", entry);
}
Console.Write("\n\n");
}
}
/*
This example produces the following results:
1) Split a string delimited by characters:
1a )The original string is ",ONE,,TWO,,,THREE,,".
The delimiter character is ','.
1b) Split a string delimited by characters and return all elements:
The return value contains these 9 elements:
<><ONE><><TWO><><><THREE><><>
1c) Split a string delimited by characters and return all non-empty elements:
The return value contains these 3 elements:
<ONE><TWO><THREE>
1d) Split a string delimited by characters and return 2 elements:
The return value contains these 2 elements:
<><ONE,,TWO,,,THREE,,>
1e) Split a string delimited by characters and return 2 non-empty elements:
The return value contains these 2 elements:
<ONE><TWO,,,THREE,,>
2) Split a string delimited by another string:
2a) The original string is "[stop]ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]".
The delimiter string is "[stop]".
2b) Split a string delimited by another string and return all elements:
The return value contains these 9 elements:
<空><ONE><空><TWO><空><空><THREE><空><空>
2c) Split a string delimited by another string and return all non-empty elements:
The return value contains these 3 elements:
<ONE><TWO><THREE>
2d) Split a string delimited by another string and return 2 elements:
The return value contains these 2 elements:
<><ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]>
2e) Split a string delimited by another string and return 2 non-empty elements:
The return value contains these 2 elements:
<ONE><TWO[stop][stop][stop]THREE[stop][stop]>
// the StringSplitOptions enumeration.
using System;
class Sample
{
public static void Main()
{
string s1 = " ,ONE,,TWO,,,THREE,,";
string s2 = "[stop]" +
"ONE[stop][stop]" +
"TWO[stop][stop][stop]" +
"THREE[stop][stop]";
char[] charSeparators = new char[] {' ,'};
string[] stringSeparators = new string[] {"[stop]"};
string[] result;
// ------------------------------------------------------------------------------
// Split a string delimited by characters.
// ------------------------------------------------------------------------------
Console.WriteLine("1) Split a string delimited by characters:\n");
// Display the original string and delimiter characters.
Console.WriteLine("1a )The original string is \"{0}\".", s1);
Console.WriteLine("The delimiter character is '{0}'.\n",
charSeparators[0]);
// Split a string delimited by characters and return all elements.
Console.WriteLine("1b) Split a string delimited by characters and " +
"return all elements:");
result = s1.Split(charSeparators, StringSplitOptions.None);
Show(result);
// Split a string delimited by characters and return all non-empty elements.
Console.WriteLine("1c) Split a string delimited by characters and " +
"return all non-empty elements:");
result = s1.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// Split the original string into the string and empty string before the
// delimiter and the remainder of the original string after the delimiter.
Console.WriteLine("1d) Split a string delimited by characters and " +
"return 2 elements:");
result = s1.Split(charSeparators, 2, StringSplitOptions.None);
Show(result);
// Split the original string into the string after the delimiter and the
// remainder of the original string after the delimiter.
Console.WriteLine("1e) Split a string delimited by characters and " +
"return 2 non-empty elements:");
result = s1.Split(charSeparators, 2, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// ------------------------------------------------------------------------------
// Split a string delimited by another string.
// ------------------------------------------------------------------------------
Console.WriteLine("2) Split a string delimited by another string:\n");
// Display the original string and delimiter string.
Console.WriteLine("2a) The original string is \"{0}\".", s2);
Console.WriteLine("The delimiter string is \"{0}\".\n", stringSeparators[0]);
// Split a string delimited by another string and return all elements.
Console.WriteLine("2b) Split a string delimited by another string and " +
"return all elements:");
result = s2.Split(stringSeparators, StringSplitOptions.None);
Show(result);
// Split the original string at the delimiter and return all non-empty elements.
Console.WriteLine("2c) Split a string delimited by another string and " +
"return all non-empty elements:");
result = s2.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// Split the original string into the empty string before the
// delimiter and the remainder of the original string after the delimiter.
Console.WriteLine("2d) Split a string delimited by another string and " +
"return 2 elements:");
result = s2.Split(stringSeparators, 2, StringSplitOptions.None);
Show(result);
// Split the original string into the string after the delimiter and the
// remainder of the original string after the delimiter.
Console.WriteLine("2e) Split a string delimited by another string and " +
"return 2 non-empty elements:");
result = s2.Split(stringSeparators, 2, StringSplitOptions.RemoveEmptyEntries);
Show(result);
}
// Display the array of separated strings.
public static void Show(string[] entries)
{
Console.WriteLine("The return value contains these {0} elements:", entries.Length);
foreach (string entry in entries)
{
Console.Write("<{0}>", entry);
}
Console.Write("\n\n");
}
}
/*
This example produces the following results:
1) Split a string delimited by characters:
1a )The original string is ",ONE,,TWO,,,THREE,,".
The delimiter character is ','.
1b) Split a string delimited by characters and return all elements:
The return value contains these 9 elements:
<><ONE><><TWO><><><THREE><><>
1c) Split a string delimited by characters and return all non-empty elements:
The return value contains these 3 elements:
<ONE><TWO><THREE>
1d) Split a string delimited by characters and return 2 elements:
The return value contains these 2 elements:
<><ONE,,TWO,,,THREE,,>
1e) Split a string delimited by characters and return 2 non-empty elements:
The return value contains these 2 elements:
<ONE><TWO,,,THREE,,>
2) Split a string delimited by another string:
2a) The original string is "[stop]ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]".
The delimiter string is "[stop]".
2b) Split a string delimited by another string and return all elements:
The return value contains these 9 elements:
<空><ONE><空><TWO><空><空><THREE><空><空>
2c) Split a string delimited by another string and return all non-empty elements:
The return value contains these 3 elements:
<ONE><TWO><THREE>
2d) Split a string delimited by another string and return 2 elements:
The return value contains these 2 elements:
<><ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]>
2e) Split a string delimited by another string and return 2 non-empty elements:
The return value contains these 2 elements:
<ONE><TWO[stop][stop][stop]THREE[stop][stop]>
#25
该结帖啦~~
#26
学习啦
#27
可行
#28
C# code
String input="asasdREV2315D",a="",b="";
Int32 n=input.IndexOf("REV");
if(n>-1){
a=input.SubString(0,n);
b=input.SubString(n);
}
else
a=input;
String input="asasdREV2315D",a="",b="";
Int32 n=input.IndexOf("REV");
if(n>-1){
a=input.SubString(0,n);
b=input.SubString(n);
}
else
a=input;
#29
学习了
#1
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
#2
up
#3
试下
#4
#5
string ss = s.Substring(0, 5);
string st = s.Remove(0, 5);
string st = s.Remove(0, 5);
#6
正确
5楼的不行
或者是用indexof获取rev的位置,然后substring(i,l)
#7
easy
#8
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
#9
关于字符串及数组转换,详见
http://blog.csdn.net/simonezhlx/archive/2008/10/17/3091956.aspx
http://blog.csdn.net/simonezhlx/archive/2008/10/17/3091956.aspx
#10
用split函数。
#11
楼主结贴吧
#12
C# code
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
代码分析:
s=“xxxxxxREVxxxxx”
s=“xxxxxREVREVxxxxx”
s=“xxxxxxREVxxxxxxDREV”
s=“REVxxxxxREVxxxxxDREV”
s=“REVxxxxxREVxxxxREVxxxxx”
s=“REVxxxxxrevxxxxREVxxxxx”
请自己测试去,
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
代码分析:
s=“xxxxxxREVxxxxx”
s=“xxxxxREVREVxxxxx”
s=“xxxxxxREVxxxxxxDREV”
s=“REVxxxxxREVxxxxxDREV”
s=“REVxxxxxREVxxxxREVxxxxx”
s=“REVxxxxxrevxxxxREVxxxxx”
请自己测试去,
#13
up
#14
方法说的差不多了,帮你顶吧,来晚喽
#15
学习啦
#16
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
结果:
ss[0]="asasd";
ss[1]="2315D";
#17
正则表达式!!
#18
如楼上所述,将"REV"视为分隔符即可
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
string[] ss = s.Split(new string[] { "REV" },StringSplitOptions.None);
#19
楼上各位,搂主是不是已经确定字符串中只有一个“REV”?
如果是:asasdREVREV5D该如何?
如果是:asasdREVREV5D该如何?
#20
楼主要的结果中后一个字符串是要带REV的
string[] result = System.Text.RegularExpressions.Regex.Split("asasdREV2315D", @"(?=REV)");
foreach (string s in result)
{
richTextBox1.Text += s + "\n";
}
#21
试了代码:不错啊,有学习了一招
#22
... ... 这个,这个 ... ...
#23
显然错误...
original:asasdREV2315D
result:asasd
2315D
曲解了红色部分枚举值的含义...
Root_正解.
#24
This example demonstrates the String() methods that use
// the StringSplitOptions enumeration.
using System;
class Sample
{
public static void Main()
{
string s1 = " ,ONE,,TWO,,,THREE,,";
string s2 = "[stop]" +
"ONE[stop][stop]" +
"TWO[stop][stop][stop]" +
"THREE[stop][stop]";
char[] charSeparators = new char[] {' ,'};
string[] stringSeparators = new string[] {"[stop]"};
string[] result;
// ------------------------------------------------------------------------------
// Split a string delimited by characters.
// ------------------------------------------------------------------------------
Console.WriteLine("1) Split a string delimited by characters:\n");
// Display the original string and delimiter characters.
Console.WriteLine("1a )The original string is \"{0}\".", s1);
Console.WriteLine("The delimiter character is '{0}'.\n",
charSeparators[0]);
// Split a string delimited by characters and return all elements.
Console.WriteLine("1b) Split a string delimited by characters and " +
"return all elements:");
result = s1.Split(charSeparators, StringSplitOptions.None);
Show(result);
// Split a string delimited by characters and return all non-empty elements.
Console.WriteLine("1c) Split a string delimited by characters and " +
"return all non-empty elements:");
result = s1.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// Split the original string into the string and empty string before the
// delimiter and the remainder of the original string after the delimiter.
Console.WriteLine("1d) Split a string delimited by characters and " +
"return 2 elements:");
result = s1.Split(charSeparators, 2, StringSplitOptions.None);
Show(result);
// Split the original string into the string after the delimiter and the
// remainder of the original string after the delimiter.
Console.WriteLine("1e) Split a string delimited by characters and " +
"return 2 non-empty elements:");
result = s1.Split(charSeparators, 2, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// ------------------------------------------------------------------------------
// Split a string delimited by another string.
// ------------------------------------------------------------------------------
Console.WriteLine("2) Split a string delimited by another string:\n");
// Display the original string and delimiter string.
Console.WriteLine("2a) The original string is \"{0}\".", s2);
Console.WriteLine("The delimiter string is \"{0}\".\n", stringSeparators[0]);
// Split a string delimited by another string and return all elements.
Console.WriteLine("2b) Split a string delimited by another string and " +
"return all elements:");
result = s2.Split(stringSeparators, StringSplitOptions.None);
Show(result);
// Split the original string at the delimiter and return all non-empty elements.
Console.WriteLine("2c) Split a string delimited by another string and " +
"return all non-empty elements:");
result = s2.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// Split the original string into the empty string before the
// delimiter and the remainder of the original string after the delimiter.
Console.WriteLine("2d) Split a string delimited by another string and " +
"return 2 elements:");
result = s2.Split(stringSeparators, 2, StringSplitOptions.None);
Show(result);
// Split the original string into the string after the delimiter and the
// remainder of the original string after the delimiter.
Console.WriteLine("2e) Split a string delimited by another string and " +
"return 2 non-empty elements:");
result = s2.Split(stringSeparators, 2, StringSplitOptions.RemoveEmptyEntries);
Show(result);
}
// Display the array of separated strings.
public static void Show(string[] entries)
{
Console.WriteLine("The return value contains these {0} elements:", entries.Length);
foreach (string entry in entries)
{
Console.Write("<{0}>", entry);
}
Console.Write("\n\n");
}
}
/*
This example produces the following results:
1) Split a string delimited by characters:
1a )The original string is ",ONE,,TWO,,,THREE,,".
The delimiter character is ','.
1b) Split a string delimited by characters and return all elements:
The return value contains these 9 elements:
<><ONE><><TWO><><><THREE><><>
1c) Split a string delimited by characters and return all non-empty elements:
The return value contains these 3 elements:
<ONE><TWO><THREE>
1d) Split a string delimited by characters and return 2 elements:
The return value contains these 2 elements:
<><ONE,,TWO,,,THREE,,>
1e) Split a string delimited by characters and return 2 non-empty elements:
The return value contains these 2 elements:
<ONE><TWO,,,THREE,,>
2) Split a string delimited by another string:
2a) The original string is "[stop]ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]".
The delimiter string is "[stop]".
2b) Split a string delimited by another string and return all elements:
The return value contains these 9 elements:
<空><ONE><空><TWO><空><空><THREE><空><空>
2c) Split a string delimited by another string and return all non-empty elements:
The return value contains these 3 elements:
<ONE><TWO><THREE>
2d) Split a string delimited by another string and return 2 elements:
The return value contains these 2 elements:
<><ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]>
2e) Split a string delimited by another string and return 2 non-empty elements:
The return value contains these 2 elements:
<ONE><TWO[stop][stop][stop]THREE[stop][stop]>
// the StringSplitOptions enumeration.
using System;
class Sample
{
public static void Main()
{
string s1 = " ,ONE,,TWO,,,THREE,,";
string s2 = "[stop]" +
"ONE[stop][stop]" +
"TWO[stop][stop][stop]" +
"THREE[stop][stop]";
char[] charSeparators = new char[] {' ,'};
string[] stringSeparators = new string[] {"[stop]"};
string[] result;
// ------------------------------------------------------------------------------
// Split a string delimited by characters.
// ------------------------------------------------------------------------------
Console.WriteLine("1) Split a string delimited by characters:\n");
// Display the original string and delimiter characters.
Console.WriteLine("1a )The original string is \"{0}\".", s1);
Console.WriteLine("The delimiter character is '{0}'.\n",
charSeparators[0]);
// Split a string delimited by characters and return all elements.
Console.WriteLine("1b) Split a string delimited by characters and " +
"return all elements:");
result = s1.Split(charSeparators, StringSplitOptions.None);
Show(result);
// Split a string delimited by characters and return all non-empty elements.
Console.WriteLine("1c) Split a string delimited by characters and " +
"return all non-empty elements:");
result = s1.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// Split the original string into the string and empty string before the
// delimiter and the remainder of the original string after the delimiter.
Console.WriteLine("1d) Split a string delimited by characters and " +
"return 2 elements:");
result = s1.Split(charSeparators, 2, StringSplitOptions.None);
Show(result);
// Split the original string into the string after the delimiter and the
// remainder of the original string after the delimiter.
Console.WriteLine("1e) Split a string delimited by characters and " +
"return 2 non-empty elements:");
result = s1.Split(charSeparators, 2, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// ------------------------------------------------------------------------------
// Split a string delimited by another string.
// ------------------------------------------------------------------------------
Console.WriteLine("2) Split a string delimited by another string:\n");
// Display the original string and delimiter string.
Console.WriteLine("2a) The original string is \"{0}\".", s2);
Console.WriteLine("The delimiter string is \"{0}\".\n", stringSeparators[0]);
// Split a string delimited by another string and return all elements.
Console.WriteLine("2b) Split a string delimited by another string and " +
"return all elements:");
result = s2.Split(stringSeparators, StringSplitOptions.None);
Show(result);
// Split the original string at the delimiter and return all non-empty elements.
Console.WriteLine("2c) Split a string delimited by another string and " +
"return all non-empty elements:");
result = s2.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
Show(result);
// Split the original string into the empty string before the
// delimiter and the remainder of the original string after the delimiter.
Console.WriteLine("2d) Split a string delimited by another string and " +
"return 2 elements:");
result = s2.Split(stringSeparators, 2, StringSplitOptions.None);
Show(result);
// Split the original string into the string after the delimiter and the
// remainder of the original string after the delimiter.
Console.WriteLine("2e) Split a string delimited by another string and " +
"return 2 non-empty elements:");
result = s2.Split(stringSeparators, 2, StringSplitOptions.RemoveEmptyEntries);
Show(result);
}
// Display the array of separated strings.
public static void Show(string[] entries)
{
Console.WriteLine("The return value contains these {0} elements:", entries.Length);
foreach (string entry in entries)
{
Console.Write("<{0}>", entry);
}
Console.Write("\n\n");
}
}
/*
This example produces the following results:
1) Split a string delimited by characters:
1a )The original string is ",ONE,,TWO,,,THREE,,".
The delimiter character is ','.
1b) Split a string delimited by characters and return all elements:
The return value contains these 9 elements:
<><ONE><><TWO><><><THREE><><>
1c) Split a string delimited by characters and return all non-empty elements:
The return value contains these 3 elements:
<ONE><TWO><THREE>
1d) Split a string delimited by characters and return 2 elements:
The return value contains these 2 elements:
<><ONE,,TWO,,,THREE,,>
1e) Split a string delimited by characters and return 2 non-empty elements:
The return value contains these 2 elements:
<ONE><TWO,,,THREE,,>
2) Split a string delimited by another string:
2a) The original string is "[stop]ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]".
The delimiter string is "[stop]".
2b) Split a string delimited by another string and return all elements:
The return value contains these 9 elements:
<空><ONE><空><TWO><空><空><THREE><空><空>
2c) Split a string delimited by another string and return all non-empty elements:
The return value contains these 3 elements:
<ONE><TWO><THREE>
2d) Split a string delimited by another string and return 2 elements:
The return value contains these 2 elements:
<><ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]>
2e) Split a string delimited by another string and return 2 non-empty elements:
The return value contains these 2 elements:
<ONE><TWO[stop][stop][stop]THREE[stop][stop]>
#25
该结帖啦~~
#26
学习啦
#27
可行
#28
C# code
String input="asasdREV2315D",a="",b="";
Int32 n=input.IndexOf("REV");
if(n>-1){
a=input.SubString(0,n);
b=input.SubString(n);
}
else
a=input;
String input="asasdREV2315D",a="",b="";
Int32 n=input.IndexOf("REV");
if(n>-1){
a=input.SubString(0,n);
b=input.SubString(n);
}
else
a=input;
#29
学习了