1 |
bearsoft |
1.1 |
#include "../../String/String.h"
|
2 |
|
|
#include "../../String/StringInput.h"
|
3 |
|
|
#include "../../System/System.h"
|
4 |
|
|
#include "StringTest3.h"
|
5 |
|
|
#include "../../System/SystemDefine.h"
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
StringTest3::StringTest3(){}
|
9 |
|
|
StringTest3::~StringTest3(){}
|
10 |
|
|
|
11 |
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
12 |
|
|
//scan words from a string,ascii buffer, stringtokenizer in java
|
13 |
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
14 |
|
|
|
15 |
|
|
void StringTest3::run()
|
16 |
|
|
{
|
17 |
|
|
StringInput *stringInput=new StringInput();
|
18 |
|
|
|
19 |
|
|
stringInput->readFile("data/test.txt");
|
20 |
|
|
|
21 |
|
|
// stringInput->dontDefragMemory(1000); // select this if you want to have intern word buffer == less malloc, free
|
22 |
|
|
|
23 |
|
|
while (stringInput->getScanWordStatus())
|
24 |
|
|
{
|
25 |
|
|
String temp=stringInput->scanWord();
|
26 |
|
|
|
27 |
|
|
if(stringInput->getScanWordStatus())
|
28 |
|
|
{
|
29 |
|
|
System::println(temp.buffer);
|
30 |
|
|
}
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
stringInput->resetScanWord(); //moves the pointer to the begining of the string buffer again
|
34 |
|
|
|
35 |
|
|
delete stringInput;
|
36 |
|
|
} |