This commit is contained in:
2026-04-29 21:52:19 -04:00
parent b41a06bda8
commit 0f8c7ed2ed
5 changed files with 106 additions and 2 deletions

View File

@ -721,7 +721,7 @@ namespace ams
bool beq;
bool b1,b2;
I = 0;
I = indstart;
J = 0;
while(I<length&&qf==0)
{
@ -768,6 +768,45 @@ namespace ams
return ret;
}
int amsstring::findright(const amsstring findstr, const int indstart, const bool casesens) const
{
int ret = -1;
ret = findright(findstr.cstring,indstart,casesens);
return ret;
}
int amsstring::findright(const ams_chartype *findstr, const int indstart, const bool casesens) const
{
int ret = -1;
//todo
return ret;
}
int amsstring::findright(const ams_chartype c, const int indstart, const bool casesens) const
{
int ret = -1;
//todo
bool b1,b2,qf;
int I;
for(I=length-indstart-1;I>=0;I--)
{
b1 = casesens&&(cstring[I]==c);
b2 = (!casesens)&&(ams::tolower(cstring[I])==ams::tolower(c));
if(b1 || b2)
{
ret = I;
break;
}
}
return ret;
}
void amsstring::tolower()
{
std::locale loc;

View File

@ -285,6 +285,40 @@ amsstring stripwhitespace(const amsstring &s)
{
amsstring ret;
int I;
int ind1;
int ind2;
ams_chartype c;
ind1 = 0;
ind2 = 0;
for(I=0;I<s.length;I++)
{
c = s.cstring[I];
if(!(isspace(c)||c==' '||c=='\t'))
{
ind1 = I;
break;
}
}
for(I=s.length-1;I>=0;I--)
{
c = s.cstring[I];
if(!(isspace(c)||c==' '||c=='\t'))
{
ind2 = I+1;
break;
}
}
ind1 = min<int>(ind1,s.size());
ind1 = max<int>(ind1,0);
ind2 = min<int>(ind2,s.size());
ind2 = max<int>(ind2,0);
ind2 = max<int>(ind1,ind2);
ret = s.substring(ind1,ind2);
return ret;
}
@ -292,6 +326,24 @@ amsstring stripallwhitespace(const amsstring &s)
{
amsstring ret;
ret.resize(s.length);
//int count;
int I;
int J;
J = 0;
ams_chartype c;
for(I=0;I<s.length;I++)
{
c = s.cstring[I];
if(!(isspace(c)||c==' '||c=='\t'||c=='\n'||c=='\r'||c=='\f'||c=='\v'||(int)c==9||(int)c==10||(int)c==11||(int)c==12))
{
ret.cstring[J] = s.cstring[I];
J = J + 1;
}
}
ret.resize(J);
ret.cstring[ret.length]='\0';
return ret;
}
@ -301,6 +353,8 @@ amsarray<amsstring> splitext(const amsstring &s)
{
amsarray<amsstring> ret;
//todo
return ret;
}
@ -310,6 +364,8 @@ amsarray<amsstring> splitpath(const amsstring &s)
{
amsarray<amsstring> ret;
//todo
return ret;
}
@ -318,6 +374,8 @@ amsstring select_between(const amsstring &s, const ams_chartype delimitleft, con
{
amsstring ret;
//todo
return ret;
}
@ -325,6 +383,13 @@ amsstring concatenate(const amsarray<amsstring> &slist)
{
amsstring ret;
int I;
ret.resize(0);
for(I=0;I<slist.length;I++)
{
ret.append(slist[I]);
}
return ret;
}