123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using System;
- using System.Collections.Generic;
- namespace ET.Server;
- public static class CardHelper
- {
-
-
-
-
-
-
- public static int[] Remove(int[] target, int v)
- {
- int len = target.Length;
- if (len == 0)
- {
- return target;
- }
-
- for (int i = 0; i < len; i++)
- {
- if (target[i] == v)
- {
- int[] dest = new int[len - 1];
- if (i > 0)
- {
- Array.Copy(target, 0, dest, 0, i);
- }
- if (i != len - 1)
- {
- Array.Copy(target, i + 1, dest, i, len - i - 1);
- }
- return dest;
- }
- }
-
- return target;
- }
-
-
-
-
-
-
-
- public static int[] Add(int[] src, int v) {
- List<int> list = new List<int>(src);
- list.Add(v);
- return list.ToArray();
- }
-
-
-
-
-
-
- public static int CountCardNum(int[] target, int card) {
- int i = 0;
- foreach (int tar in target)
- {
- if (tar == card)
- {
- i++;
- }
- }
- return i;
- }
- }
|