1 |
bearsoft |
1.1 |
#include "../../String/String.h"
|
2 |
|
|
#include "../../String/StringInput.h"
|
3 |
|
|
#include "../../System/System.h"
|
4 |
|
|
#include "StringTest6.h"
|
5 |
|
|
#include "../../System/SystemDefine.h"
|
6 |
|
|
|
7 |
|
|
StringTest6::StringTest6(){}
|
8 |
|
|
StringTest6::~StringTest6(){}
|
9 |
|
|
|
10 |
|
|
void StringTest6::run()
|
11 |
|
|
{
|
12 |
|
|
StringInput *stringInput=new StringInput();
|
13 |
|
|
|
14 |
|
|
stringInput->readFile("data/cut.txt");
|
15 |
|
|
|
16 |
|
|
// stringInput->dontDefragMemory(1000); // select this if you want to have intern word buffer == less malloc, free
|
17 |
|
|
|
18 |
|
|
String target="path://";
|
19 |
|
|
|
20 |
|
|
String result=stringInput->cutTheBackMergeStrings("file",target.buffer);
|
21 |
|
|
|
22 |
|
|
System::println(result.buffer);
|
23 |
|
|
|
24 |
|
|
delete stringInput;
|
25 |
|
|
|
26 |
|
|
/*
|
27 |
|
|
string->resetSourceBuffer();
|
28 |
|
|
|
29 |
|
|
unsigned char* endTarget=(unsigned char*)"per";
|
30 |
|
|
unsigned char* endTarget2=(unsigned char*)"morsan";
|
31 |
|
|
|
32 |
|
|
int *endTargetPointers=string->getEndTargetPointers();
|
33 |
|
|
endTargetPointers[0]=(int)endTarget;
|
34 |
|
|
endTargetPointers[1]=(int)endTarget2;
|
35 |
|
|
endTargetPointers[2]=0;
|
36 |
|
|
|
37 |
|
|
temp=string->findWord((unsigned char*)"per");
|
38 |
|
|
|
39 |
|
|
if ( temp == (unsigned char*)-1 )
|
40 |
|
|
{
|
41 |
|
|
cout << "stop" << endl;
|
42 |
|
|
}
|
43 |
|
|
else
|
44 |
|
|
{
|
45 |
|
|
if ( temp != 0 )
|
46 |
|
|
{
|
47 |
|
|
cout << temp << endl;
|
48 |
|
|
// free(temp);
|
49 |
|
|
}
|
50 |
|
|
}
|
51 |
|
|
*/
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
} |