mirror of
https://onedev.site.tesses.net/crosslang
synced 2026-02-09 01:25:45 +00:00
Fix IndexOf
This commit is contained in:
@@ -2930,6 +2930,35 @@ namespace Tesses::CrossLang {
|
|||||||
}
|
}
|
||||||
else throw VMException("String.PadRight must have a long for width");
|
else throw VMException("String.PadRight must have a long for width");
|
||||||
}
|
}
|
||||||
|
if(key == "Contains")
|
||||||
|
{
|
||||||
|
std::string str2;
|
||||||
|
char c;
|
||||||
|
if(GetArgument(args,0,str2))
|
||||||
|
{
|
||||||
|
|
||||||
|
int64_t index = 0;
|
||||||
|
GetArgument(args,1,index);
|
||||||
|
|
||||||
|
auto res = str.find(str2,(std::size_t)index);
|
||||||
|
|
||||||
|
cse.back()->Push(gc, res != std::string::npos);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(GetArgument<char>(args,0,c))
|
||||||
|
{
|
||||||
|
int64_t index = 0;
|
||||||
|
GetArgument(args,1,index);
|
||||||
|
|
||||||
|
auto res = str.find_first_of(c,(std::size_t)index);
|
||||||
|
|
||||||
|
cse.back()->Push(gc, res != std::string::npos);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cse.back()->Push(gc,nullptr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if(key == "IndexOf")
|
if(key == "IndexOf")
|
||||||
{
|
{
|
||||||
std::string str2;
|
std::string str2;
|
||||||
@@ -2937,7 +2966,7 @@ namespace Tesses::CrossLang {
|
|||||||
if(GetArgument(args,0,str2))
|
if(GetArgument(args,0,str2))
|
||||||
{
|
{
|
||||||
|
|
||||||
int64_t index = str.size();
|
int64_t index = 0;
|
||||||
GetArgument(args,1,index);
|
GetArgument(args,1,index);
|
||||||
|
|
||||||
auto res = str.find(str2,(std::size_t)index);
|
auto res = str.find(str2,(std::size_t)index);
|
||||||
|
|||||||
Reference in New Issue
Block a user