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 );//包括模糊搜索匹配

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM