Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


tokenize method

e4321e4321 Member Posts: 6
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.

#pragma once

class Tokenizer
void tokenize(char *s1, char *s2){
for(int i=0; i for(int j=0; j if(s1[i]==s2[j]){

while(i l.add(s2[i]);

char * s1, * s2, * s3[][];
LinkedList * l=new LinkedList();



  • LundinLundin Member Posts: 3,711
    I don't quite understand what you want. The algorithm itself doesn't make any sense. And where are the strings allocated?

    char * s1, * s2, * s3[][];

    Why did you make two one-dimensional pointers and one three-dimensional?

    : LinkedList * l=new LinkedList();

    This isn't valid C++, all initialization must be done in the constructor.

    : while(i
    This won't work, s2 is a pointer and not a statically allocated array.
  • e4321e4321 Member Posts: 6
    I was trying to separate between delimiters and string literals (sin, cos, tan) and store them in one string, but I am not sure if this is the exact requirement.

Sign In or Register to comment.