Hello,
Could some body help me how could i delete any duplicate or same record of the input ?
This is my plan but i am not sure it si working with C++ or not :-
My program will be pass "number" values to this function and the function will be find out all the match number from the numbering list (mCUGParameter variables) and save it into array. Finally the function will be delete any duplicate record of the array and print it.
Example of numbering list:-
#Input or number=group,date1,date2
01200485=31595,20060307120553,
01200485=31595,20060307120553,
01940403=31595,20060307120553,
01940403=31595,20060307120553,
01940403=31595,20060307120553,20060607120553
Expected result:-
01200485=31595,20060307120553,
01940403=31595,20060307120553,
01940403=31595,20060307120553,20060607120553
Then, i do not know how could i delete any duplicate input here... could somebody help me ?
or is it ok with my steps or my ideas ?
bool getCUGParameter(const G_String& number, int *cugIndex,
int *createTS, int *terminateTS)
{
int mycharstr[100];
int mycharstr1[30];
int mycharstr2[30];
int mycharstr3[30];
G_DynArray<Parameter> matchedstrlist;
G_String matchedstr;
G_String lookupvalue;
int numofmatchedstr;
memset(mycharstr, '\0', sizeof(mycharstr));
memset(mycharstr1, '\0', sizeof(mycharstr1));
memset(mycharstr2, '\0', sizeof(mycharstr2));
memset(mycharstr3, '\0', sizeof(mycharstr3));
// find all matches number from mCUGParameter
matchedstrlist = mCUGParameter.findMultipleMatchesWithoutEIgnoreSpace(number);
numofmatchedstr = matchedstrlist.size();
if (numofmatchedstr > 0) {
int m;
for (m=0; m <= numofmatchedstr; m++) {
lookupvalue=matchedstrlist[m].getValue();
removeBlank(lookupvalue);
sscanf(lookupvalue.cStr(), "%s", mycharstr);
int i = 0;
int j = 0;
int k = 0;
for (i=0; mycharstr[i] != '\0'; i++) {
if (mycharstr[i] == ',') {
j++;
k = 0;
} else {
if (j == 0) {
mycharstr1[k] = mycharstr[i];
} else if (j == 1) {
mycharstr2[k] = mycharstr[i];
} else if (j ==2) {
mycharstr3[k] = mycharstr[i];
} else {
// do nothing
}
k++;
}
cugIndex[m] = mycharstr1[k];
createTS[m] = mycharstr2[k];
terminateTS[m] = mycharstr3[k];
}
}
for (m=0; m < numofmatchedstr; m++) {
cout << "TEST: " << cugIndex[m] << " - " << createTS[m] << " - " << terminateTS[m] << endl;
}
return true;
} else {
return false;
}
}