update runtime logic

优化字符串拼接方法。
This commit is contained in:
hevinci
2022-12-07 17:52:32 +08:00
parent 3a81d7babd
commit 45ca1ebf02
4 changed files with 29 additions and 72 deletions
@@ -55,37 +55,6 @@ namespace YooAsset
return _cacheBuilder.ToString();
}
public static List<string> StringToStringList(string str, char separator)
{
List<string> result = new List<string>();
if (!String.IsNullOrEmpty(str))
{
string[] splits = str.Split(separator);
foreach (string split in splits)
{
string value = split.Trim(); //移除首尾空格
if (!String.IsNullOrEmpty(value))
{
result.Add(value);
}
}
}
return result;
}
public static bool StringToBool(string str)
{
int value = (int)Convert.ChangeType(str, typeof(int));
return value > 0;
}
public static T NameToEnum<T>(string name)
{
if (Enum.IsDefined(typeof(T), name) == false)
{
throw new ArgumentException($"Enum {typeof(T)} is not defined name {name}");
}
return (T)Enum.Parse(typeof(T), name);
}
public static string RemoveFirstChar(string str)
{
if (string.IsNullOrEmpty(str))