1 |
bearsoft |
1.1 |
#include "../../String/String.h"
|
2 |
|
|
#include "../../String/StringInput.h"
|
3 |
|
|
#include "../../String/StringTools.h"
|
4 |
|
|
#include "../../String/Parse.h"
|
5 |
|
|
#include "../../System/System.h"
|
6 |
|
|
#include "../../Array/IntArray.h"
|
7 |
|
|
#include "../../Array/FloatArray.h"
|
8 |
|
|
#include "../../Array/StringArray.h"
|
9 |
|
|
#include "ArrayTest3.h"
|
10 |
|
|
#include "../../System/SystemDefine.h"
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
ArrayTest3::ArrayTest3(){}
|
14 |
|
|
ArrayTest3::~ArrayTest3(){}
|
15 |
|
|
|
16 |
|
|
void ArrayTest3::run()
|
17 |
|
|
{
|
18 |
|
|
|
19 |
|
|
StringArray *stringArray=new StringArray(5);
|
20 |
|
|
|
21 |
|
|
stringArray->setString("1",0);
|
22 |
|
|
stringArray->setString("5",1);
|
23 |
|
|
stringArray->setString("4",2);
|
24 |
|
|
stringArray->setString("3",3);
|
25 |
|
|
stringArray->setString("2",4);
|
26 |
|
|
|
27 |
|
|
String arrayInfo="StringValue: ";
|
28 |
|
|
|
29 |
|
|
for ( int r=0; r<stringArray->size ; r++ )
|
30 |
|
|
{
|
31 |
|
|
System::println(arrayInfo + "nonSorted " + stringArray->getString(r));
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
stringArray->sortSmallestOrder();
|
35 |
|
|
|
36 |
|
|
for ( int r2=0; r2<stringArray->size ; r2++ )
|
37 |
|
|
{
|
38 |
|
|
System::println(arrayInfo + " sorted " + stringArray->getString(r2));
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
delete stringArray;
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
StringArray *stringArray2=new StringArray();
|
45 |
|
|
|
46 |
|
|
stringArray2->addLast("3.2f2");
|
47 |
|
|
stringArray2->addLast("4.2f");
|
48 |
|
|
stringArray2->addLast("3.2f");
|
49 |
|
|
stringArray2->addLast("3.f2");
|
50 |
|
|
|
51 |
|
|
String arrayInfo2="intValue: ";
|
52 |
|
|
|
53 |
|
|
for ( int t=0; t<stringArray2->size ; t++ )
|
54 |
|
|
{
|
55 |
|
|
System::println(arrayInfo2 + "nonSorted " + stringArray2->getString(t));
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
stringArray2->sortLargestOrder();
|
59 |
|
|
|
60 |
|
|
for ( int t2=0; t2<stringArray2->size ; t2++ )
|
61 |
|
|
{
|
62 |
|
|
System::println(arrayInfo2 + " sorted " + stringArray2->getString(t2));
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
delete stringArray2;
|
67 |
|
|
/*
|
68 |
|
|
String arne="3.3f";
|
69 |
|
|
String kalle="4.2f";
|
70 |
|
|
|
71 |
|
|
if(StringTools::isStringSmaller(arne.buffer,arne.length,kalle.buffer,kalle.length))
|
72 |
|
|
{
|
73 |
|
|
System::println("halleluja");
|
74 |
|
|
}
|
75 |
|
|
*/
|
76 |
|
|
} |