using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CoreCms.Net.Utility.Extensions { /// /// 字符串扩展 /// public static class StringExtensions { /// /// str 转int /// /// /// /// public static int ToInt32OrDefault(this string value, int defaultValue = 0) { if (int.TryParse(value, out int result)) { return result; } return defaultValue; } } }