mirror of
https://github.com/soarqin/DSP_Mods_TO.git
synced 2025-12-17 12:03:29 +08:00
Added CruiseAssist and AutoPilot
This commit is contained in:
29
CruiseAssist/Commons/ListUtils.cs
Normal file
29
CruiseAssist/Commons/ListUtils.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace CruiseAssist.Commons;
|
||||
|
||||
internal static class ListUtils
|
||||
{
|
||||
public static string ToString(List<int> list)
|
||||
{
|
||||
return list == null || list.Count == 0 ? "" : list.Select(id => id.ToString()).Aggregate((a, b) => a + "," + b);
|
||||
}
|
||||
|
||||
public static string ToString(List<string> list)
|
||||
{
|
||||
return list == null || list.Count == 0 ? "" : list.Aggregate((a, b) => a + "," + b);
|
||||
}
|
||||
|
||||
public static List<int> ParseToIntList(string str)
|
||||
{
|
||||
return string.IsNullOrEmpty(str)
|
||||
? []
|
||||
: str.Split(',').Where(s => int.TryParse(s, out _)).Select(int.Parse).ToList();
|
||||
}
|
||||
|
||||
public static List<string> ParseToStringList(string str)
|
||||
{
|
||||
return string.IsNullOrEmpty(str) ? [] : str.Split(',').ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user