updates
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -721,7 +721,7 @@ namespace ams
|
|||||||
bool beq;
|
bool beq;
|
||||||
bool b1,b2;
|
bool b1,b2;
|
||||||
|
|
||||||
I = 0;
|
I = indstart;
|
||||||
J = 0;
|
J = 0;
|
||||||
while(I<length&&qf==0)
|
while(I<length&&qf==0)
|
||||||
{
|
{
|
||||||
@ -767,7 +767,46 @@ namespace ams
|
|||||||
|
|
||||||
return ret;
|
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()
|
void amsstring::tolower()
|
||||||
{
|
{
|
||||||
std::locale loc;
|
std::locale loc;
|
||||||
|
|||||||
@ -285,6 +285,40 @@ amsstring stripwhitespace(const amsstring &s)
|
|||||||
{
|
{
|
||||||
amsstring ret;
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,6 +326,24 @@ amsstring stripallwhitespace(const amsstring &s)
|
|||||||
{
|
{
|
||||||
amsstring ret;
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,6 +353,8 @@ amsarray<amsstring> splitext(const amsstring &s)
|
|||||||
{
|
{
|
||||||
amsarray<amsstring> ret;
|
amsarray<amsstring> ret;
|
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,6 +364,8 @@ amsarray<amsstring> splitpath(const amsstring &s)
|
|||||||
{
|
{
|
||||||
amsarray<amsstring> ret;
|
amsarray<amsstring> ret;
|
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,6 +374,8 @@ amsstring select_between(const amsstring &s, const ams_chartype delimitleft, con
|
|||||||
{
|
{
|
||||||
amsstring ret;
|
amsstring ret;
|
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +383,13 @@ amsstring concatenate(const amsarray<amsstring> &slist)
|
|||||||
{
|
{
|
||||||
amsstring ret;
|
amsstring ret;
|
||||||
|
|
||||||
|
int I;
|
||||||
|
ret.resize(0);
|
||||||
|
for(I=0;I<slist.length;I++)
|
||||||
|
{
|
||||||
|
ret.append(slist[I]);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user