unity+搜索筛选(包含模糊搜索)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Text.RegularExpressions;

public InputField SearchInputField;


var isMatchSuccess = Regex.IsMatch(TKDeviceGroupManegerRef.SearchDeviceStringList[i],SearchInputField.text);
                if (isMatchSuccess)
                {
                    Debug.LogError("匹配~"+ SearchInputField.text);
                }
例:

 string str1 = "刘备关羽张飞孙权何问起";
string strInput = "关羽";
if (Regex.IsMatch(source, strInput )) 
{
   Debug.LogError("匹配~"+ strInput );//包括模糊搜索匹配

 

posted @ 2019-05-30 15:17  WalkingSnail  阅读(3579)  评论(0编辑  收藏  举报