54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace ZWL.Common
|
|
{
|
|
public class StringPlus
|
|
{
|
|
|
|
public static string[] GetStrArray(string str)
|
|
{
|
|
return str.Split(new char[',']);
|
|
}
|
|
|
|
public static string GetArrayStr(List<string> list,string speater)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
if (i == list.Count - 1)
|
|
{
|
|
sb.Append(list[i]);
|
|
}
|
|
else
|
|
{
|
|
sb.Append(list[i]);
|
|
sb.Append(speater);
|
|
}
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
#region 删除最后一个字符之后的字符
|
|
|
|
/// <summary>
|
|
/// 删除最后结尾的一个逗号
|
|
/// </summary>
|
|
public static string DelLastComma(string str)
|
|
{
|
|
return str.Substring(0, str.LastIndexOf(","));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除最后结尾的指定字符后的字符
|
|
/// </summary>
|
|
public static string DelLastChar(string str,string strchar)
|
|
{
|
|
return str.Substring(0, str.LastIndexOf(strchar));
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|