tokenize method

e4321's Avatar, Join Date: Jan 2009
Newbie Member
This method takes two strings as input s1, a generic string, and s2 containing delimiters. s1 is verified against s2 and depending on the type of character it is stored in a two dimensional array. The problem that I have is I am not sure if the characters are stored correctly in the array, and how to arrange the delimiter characters in increasing order.
Code:
 
#pragma once
class Tokenizer
{
public:
 Tokenizer(void);
 ~Tokenizer(void);
 void tokenize(char *s1, char *s2){
   for(int i=0; i<size of s1; i++){
      for(int j=0; j<size of s2; j++){
        if(s1[i]==s2[j]){
            s3[i]=s1[i];     
    }
    else{
     s3[k]=s1[i];
     k++;
    }
    break;     
      }
           } 
 }
 
  while(i<sizeof s2){
   l.add(s2[i]);
  }
 }
private:
 char * s1, * s2, * s3[][];
 LinkedList * l=new LinkedList();
 
};

Last edited by shabbir; 23Jan2009 at 20:16.. Reason: Code blocks
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
"I am not sure if the characters are stored correctly in the array"

What a strange way of putting it. Are they stored correctly or aren't they? If you display the array on screen does it appear as you expect?

Again this is a class on its own with no main function. Are you posting homework assignments in the hope that we'll do them for you?