Master.CanYinWu.Utility/ComHelper.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Master.CanYinWu.Utility
{
public class ComHelper
{
public static string MonthToChinese(int month)
{
Dictionary<int, string> monthNames = new Dictionary<int, string>
{
{ 1, "1月" },
{ 2, "2月" },
{ 3, "3月" },
{ 4, "4月" },
{ 5, "5月" },
{ 6, "6月" },
{ 7, "7月" },
{ 8, "8月" },
{ 9, "9月" },
{ 10, "10月" },
{ 11, "11月" },
{ 12, "12月" }
};
return monthNames[month];
}
/// <summary>
/// 在某个字符串中移除某一个字符(卡包列表中移除当前核销的卡包)
/// </summary>
/// <param name="input"></param>
/// <param name="elementToRemove"></param>
/// <returns></returns>
public static string RemoveElementFromString(string input, string elementToRemove)
{
// 将字符串分割成数组
string[] elements = input.Split(',');
// 使用LINQ来过滤掉要移除的元素
var filteredElements = elements.Where(e => e != elementToRemove && !string.IsNullOrWhiteSpace(e)).ToArray();
// 如果数组为空,则返回一个空字符串
if (filteredElements.Length == 0)
{
return string.Empty;
}
// 使用StringBuilder来连接剩余的字符串
StringBuilder sb = new StringBuilder();
for (int i = 0; i < filteredElements.Length; i++)
{
sb.Append(filteredElements[i]);
if (i < filteredElements.Length - 1)
{
sb.Append(',');
后面还有 14 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
