如题
lua如何检测字符串或变量内是否包含指定字符或数字
求这个命令。
如果我没理解错的话大概是这样的:
#include <iostream>
using namespace std;
int main()
{
string text,target;
cin>>text>>target;
if(text.find(target)!=text.npos)
cout<<"包含"<<target<<endl;
else
cout<<"不包含"<<target<<endl;
}
print(string.find("hello123","123"))
print(string.find("hello123","he3"))
存在的话 返回索引 不存在返回nil
if string.match(string, strf("你的字符", 要查找的字符)) then
a::match("123")
a是字符串,123是你要检测的内容