RolePermission.Common/ValueConvert.cs
(开头部分) 13KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;
namespace RolePermission.Common
{
/// <summary>
/// 类型转换
/// </summary>
public static partial class ValueConvert
{
/// <summary>
/// 将最后一个字符串的路径path替换
/// </summary>
/// <param name="str"></param>
/// <param name="path"></param>
/// <returns></returns>
public static string Path(this string str, string path)
{
int index = str.LastIndexOf('\\');
int indexDian = str.LastIndexOf('.');
return str.Substring(0, index + 1) + path + str.Substring(indexDian);
}
public static List<string> ToList(this string ids)
{
List<string> listId = new List<string>();
if (!string.IsNullOrEmpty(ids))
{
var sort = new SortedSet<string>(ids.Split(','));
foreach (var item in sort)
{
listId.Add(item);
}
}
return listId;
}
public static List<int> ToIntList(this string ids)
{
List<int> result = new List<string>(ids.Split(',')).ConvertAll(i => int.Parse(i));
return result;
}
/// <summary>
/// 从^分割的字符串中获取多个Id,先是用 ^ 分割,再使用 & 分割
/// </summary>
/// <param name="ids">先是用 ^ 分割,再使用 & 分割</param>
/// <returns></returns>
public static List<int> GetIdSort(this string ids)
{
List<int> listId = new List<int>();
if (!string.IsNullOrEmpty(ids))
{
var sort = new SortedSet<string>(ids.Split('^')
.Where(w => !string.IsNullOrWhiteSpace(w) && w.Contains('&'))
.Select(s => s.Substring(0, s.IndexOf('&'))));
foreach (var item in sort)
{
后面还有 316 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。