update
This commit is contained in:
1 parent
97c7e3fcef
commit
71c3cc4aef
12 files changed
+24
-6
No files matched your search
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_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)))
|
||||
{
|
||||
I1 = I;
|
||||
if(I>=(s.length-1))
|
||||
I1 = s.length;
|
||||
else
|
||||
I1 = I;
|
||||
s2 = s.substring(I0,I1);
|
||||
sa.append(s2);
|
||||
mode = 0;
|
||||
@@ -787,14 +790,14 @@ void amsstring4_test_convenience1b()
|
||||
int I;
|
||||
|
||||
s1 = "1e2e3,45, 6.7E8,-9.13E24 ";
|
||||
sa = splitalphanum(s1);
|
||||
sa = s1.splitalphanum();
|
||||
for(I=0;I<sa.length;I++)
|
||||
{
|
||||
printf("s[%d] = '%s'\n",I,sa[I].cstring);
|
||||
}
|
||||
|
||||
s1 = "arandomtuple = (apples,1.2,pi);";
|
||||
s2 = select_between(s1,"(",")");
|
||||
s2 = s1.select_between("(",")");
|
||||
printf("s1='%s'\ns2='%s'\n",s1.cstring,s2.cstring);
|
||||
|
||||
s1 = "arandomtuple = {apples,1.2,pi);";
|
||||
@@ -822,7 +825,7 @@ void amsstring4_test_convenience1b()
|
||||
printf("s1='%s'\ns2='%s'\n",s1.cstring,s2.cstring);
|
||||
|
||||
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);
|
||||
|
||||
sa.resize(0);
|
||||
@@ -842,8 +845,21 @@ void amsstring4_test_convenience1b()
|
||||
stripnewlines(&sa);
|
||||
s1 = concat_lines(sa);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
};//end namespace ams
|
||||
|
||||
+2
-1
@@ -23,7 +23,8 @@ int main(int argc, char* argv[])
|
||||
// amsstring4_test_concatenation_operators();
|
||||
|
||||
//amsstring4_test_convenience1a();
|
||||
amsstring4_test_convenience1b();
|
||||
//amsstring4_test_convenience1b();
|
||||
amsstring4_test_convenience1c();
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in new issue
Block a user