Find()查找字符
FindIndex()查找索引
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 = "2022发大财";
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();
}
}
}
评论 (0)