namespace HStation.Service
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class KeyWordHelper
|
{
|
|
//分割字符
|
private const char _split = ',';
|
|
/// <summary>
|
/// 转化为字符串
|
/// </summary>
|
public static string ToString(IEnumerable<string> list)
|
{
|
if (list == null || list.Count() < 1)
|
{
|
return string.Empty;
|
}
|
return string.Join(_split.ToString(), list.Select(x => x.Trim()));
|
}
|
|
/// <summary>
|
/// 转化为列表
|
/// </summary>
|
public static List<string> ToList(string str)
|
{
|
if (string.IsNullOrEmpty(str))
|
{
|
return new List<string>();
|
}
|
return str.Split(_split, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
|
}
|
|
}
|
}
|