update
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -21,6 +21,7 @@ namespace ams
|
|||||||
|
|
||||||
void amsstring4_test_convenience1a();
|
void amsstring4_test_convenience1a();
|
||||||
void amsstring4_test_convenience1b();
|
void amsstring4_test_convenience1b();
|
||||||
|
void amsstring4_test_convenience1c();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -511,7 +511,10 @@ amsarray<amsstring> splitalphanum(const amsstring &s)
|
|||||||
|
|
||||||
if(mode==1 && (!amsstring_ischarnumeric(c) || I>=(s.length-1)))
|
if(mode==1 && (!amsstring_ischarnumeric(c) || I>=(s.length-1)))
|
||||||
{
|
{
|
||||||
I1 = I;
|
if(I>=(s.length-1))
|
||||||
|
I1 = s.length;
|
||||||
|
else
|
||||||
|
I1 = I;
|
||||||
s2 = s.substring(I0,I1);
|
s2 = s.substring(I0,I1);
|
||||||
sa.append(s2);
|
sa.append(s2);
|
||||||
mode = 0;
|
mode = 0;
|
||||||
@ -787,14 +790,14 @@ void amsstring4_test_convenience1b()
|
|||||||
int I;
|
int I;
|
||||||
|
|
||||||
s1 = "1e2e3,45, 6.7E8,-9.13E24 ";
|
s1 = "1e2e3,45, 6.7E8,-9.13E24 ";
|
||||||
sa = splitalphanum(s1);
|
sa = s1.splitalphanum();
|
||||||
for(I=0;I<sa.length;I++)
|
for(I=0;I<sa.length;I++)
|
||||||
{
|
{
|
||||||
printf("s[%d] = '%s'\n",I,sa[I].cstring);
|
printf("s[%d] = '%s'\n",I,sa[I].cstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
s1 = "arandomtuple = (apples,1.2,pi);";
|
s1 = "arandomtuple = (apples,1.2,pi);";
|
||||||
s2 = select_between(s1,"(",")");
|
s2 = s1.select_between("(",")");
|
||||||
printf("s1='%s'\ns2='%s'\n",s1.cstring,s2.cstring);
|
printf("s1='%s'\ns2='%s'\n",s1.cstring,s2.cstring);
|
||||||
|
|
||||||
s1 = "arandomtuple = {apples,1.2,pi);";
|
s1 = "arandomtuple = {apples,1.2,pi);";
|
||||||
@ -822,7 +825,7 @@ void amsstring4_test_convenience1b()
|
|||||||
printf("s1='%s'\ns2='%s'\n",s1.cstring,s2.cstring);
|
printf("s1='%s'\ns2='%s'\n",s1.cstring,s2.cstring);
|
||||||
|
|
||||||
s1 = "kernellaunch<<<nblocks,nthreads>>>(apples,1.2,pi);";
|
s1 = "kernellaunch<<<nblocks,nthreads>>>(apples,1.2,pi);";
|
||||||
s2 = select_between(s1,"",">>>");
|
s2 = s1.select_between("",">>>");
|
||||||
printf("s1='%s'\ns2='%s'\n",s1.cstring,s2.cstring);
|
printf("s1='%s'\ns2='%s'\n",s1.cstring,s2.cstring);
|
||||||
|
|
||||||
sa.resize(0);
|
sa.resize(0);
|
||||||
@ -842,7 +845,20 @@ void amsstring4_test_convenience1b()
|
|||||||
stripnewlines(&sa);
|
stripnewlines(&sa);
|
||||||
s1 = concat_lines(sa);
|
s1 = concat_lines(sa);
|
||||||
printf("\nconcat_lines(sa) = '%s'\n----\n",s1.cstring);
|
printf("\nconcat_lines(sa) = '%s'\n----\n",s1.cstring);
|
||||||
|
}
|
||||||
|
|
||||||
|
void amsstring4_test_convenience1c()
|
||||||
|
{
|
||||||
|
amsstring s1,s2;
|
||||||
|
amsarray<amsstring> sa;
|
||||||
|
int I;
|
||||||
|
|
||||||
|
s1 = "1.2, 1.3, 6.21E7, 1.1 ";
|
||||||
|
sa = s1.splitalphanum();
|
||||||
|
for(I=0;I<sa.length;I++)
|
||||||
|
{
|
||||||
|
printf("sa[%d]='%s'\n",I,sa[I].cstring);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,8 @@ int main(int argc, char* argv[])
|
|||||||
// amsstring4_test_concatenation_operators();
|
// amsstring4_test_concatenation_operators();
|
||||||
|
|
||||||
//amsstring4_test_convenience1a();
|
//amsstring4_test_convenience1a();
|
||||||
amsstring4_test_convenience1b();
|
//amsstring4_test_convenience1b();
|
||||||
|
amsstring4_test_convenience1c();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user