C#基础(三十三) Find() 和FindIndex()的用法:找出满足集合List特定条件的字符。

参考;https://blog.csdn.net/derek_chen2012/article/details/47170189.

其中,xxx是随机起的名字。 

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QueueSample
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "你aabbbfjalj444我";
            List<char> StringList = new List<char>();
            StringList = str.ToList();
            Console.WriteLine(str);
            Console.WriteLine(StringList[0].ToString());
            Console.WriteLine(StringList[0]);

            int a = StringList.Find(xxx => xxx.Equals( '我'));
            int b = StringList.FindIndex(xxx => xxx.Equals('我'));
            Console.ReadLine();
        }
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-01-23
  • 2021-06-28
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-16
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2021-06-21
相关资源
相似解决方案