From 25d1bf4c50f43cf6690c5ac92824959865c9d78f Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期四, 13 三月 2025 10:34:40 +0800 Subject: [PATCH] BoxViewModel --- Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs | 38 +++++++++++++++++++++++++------------- 1 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs b/Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs index 0d457a9..602b3b6 100644 --- a/Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs +++ b/Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs @@ -1,25 +1,37 @@ -锘縩amespace HStation.Service +锘縩amespace HStation.Service.Assets { + /// <summary> + /// + /// </summary> public class KeyWordHelper { - public static List<string> ToList(string keyword) - { - if (string.IsNullOrEmpty(keyword)) - { - return new List<string>(); - } - return keyword.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); - } + //鍒嗗壊瀛楃 + private const char _split = ','; - public static string ToString(List<string> KeyWord) + /// <summary> + /// 杞寲涓哄瓧绗︿覆 + /// </summary> + public static string ToString(IEnumerable<string> list) { - if (KeyWord == null || KeyWord.Count < 1) + if (list == null || list.Count() < 1) { return string.Empty; } - - return string.Join(",", KeyWord); + 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(); + } + } } \ No newline at end of file -- Gitblit v1.9.3