xinjiang/SGGL/BLL/Common/StringHelper.cs

30 lines
707 B
C#

using System;
using System.Data;
using System.Linq;
namespace BLL
{
/// <summary>
/// 字符串操作辅助类
/// </summary>
public class StringHelper
{
/// <summary>
/// 字符串转换
/// 'A,B,C' => 'A','B','C'
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string StringConvert(string str)
{
string result = string.Empty;
if (!string.IsNullOrWhiteSpace(str))
{
string[] items = str.Split(',');
result = string.Join(",", items.Select(x => $"'{x}'"));
}
return result;
}
}
}