21 lines
674 B
C#
21 lines
674 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using TOOHUCardAPI.Data.Models;
|
|
|
|
namespace TOOHUCardAPI.DTO
|
|
{
|
|
public static class CardEncodingUtil
|
|
{
|
|
public static string EncodeLevelList(this IEnumerable<CardLevel> cardLevels)
|
|
{
|
|
return cardLevels.Select(cl => $"{cl.CardItemCode.Substring(6)}{cl.Level}").Aggregate(new StringBuilder(),
|
|
(ret, current) =>
|
|
{
|
|
ret.Append(string.IsNullOrWhiteSpace(ret.ToString()) ? current : $"#{current}");
|
|
return ret;
|
|
}, builder => builder.ToString());
|
|
}
|
|
}
|
|
} |