2020年5月28日 星期四

將字串從某個關鍵字串截斷,只保留關鍵字串前面的部分

 public static string 截斷(this string text, string 關鍵字)
        {
            if (text != default && text.Contains(關鍵字)) return System.Text.RegularExpressions.Regex.Split(text, 關鍵字)[0];
            else return text;
        }

沒有留言:

自訂權限驗證機制

// 使用 filter [Route("api/[controller]")] [ApiController] [Authorize] [TypeFilter(typeof(CustomAsyncAuthorizationFilter))] public c...