111,097
社区成员




/// <summary>
/// 将source转换为以sp分隔的数组
/// </summary>
/// <param name="source"></param>
/// <param name="sp"></param>
/// <returns></returns>
public static string[] SplitString(string source, string sp)
{
return Regex.Split(source, sp, RegexOptions.IgnoreCase);
}
using System;
using System.Text.RegularExpressions;
namespace ConsoleApplication2
{
class Program
{
static void Main()
{
String strTmp = "123.jpg456.jpg7j8p9g";
char[] arrChr = "jpg".ToCharArray();
string[] arr = Regex.Split(strTmp,"jpg");
foreach (String s in arr)
{
Console.WriteLine(s);
}
Console.ReadKey();
}
}
}
用String.Split真的可以吗?
static void Main()
{
String strTmp = "123.jpg456.jpg7j8p9g";
char[] arrChr = "jpg".ToCharArray();
string[] arr = strTmp.Split(arrChr);
foreach (String s in arr)
{
Console.WriteLine(s);
}
Console.ReadKey();
}
string[] pic1 = productPic.Split('JPG');
string[] pic1 = productPic.Split('JPG');