sprx parse by delimiter function - NextGenUpdate
THREAD: sprx parse by delimiter function
  1. 06-03-2018, 02:19 PM
    #1
    twistedkillas's Avatar
    twistedkillas
    I am error
    twistedkillas's Avatar
    twistedkillas
    I am error
    83
    Posts
    570
    Reputation
    Apr 2014
    NextGenUpdate
    Sponsored Links

    can someone help me with this parse function .. i want to split a string by delimiter then parse the text behind the # of the delimiter i choose


    Code:
    char *parsetheitem(char *stringz,int numb,char devider)
    {
    		char tstring[100];
    	int LineNumber2 = 0;
    	for (int z = 0; z < sizeof(stringz); z++)
    	{
    		if (stringz[z] == NULL)
    			break;
    			
    		if (stringz[z] == devider)
    		{
    			LineNumber2++;
    			if(LineNumber2==numb)
    			{
    				return tstring;
    			}
    
    				memset(tstring, 0, 100);
    		}
    		else
    			sprintf(tstring, "%s%c", tstring, stringz[z]);
    	}
    
    }

    Example

    Code:
    			char* hhh ="wee|how|can|you|do|that";
    			char * keyp1 = parsetheitem(hhh,1,'|');
    			char * keyp2 = parsetheitem(hhh,2,'|');
    			char * keyp3 = parsetheitem(hhh,3,'|');
    			char * keyp4 = parsetheitem(hhh,5,'|');

    Return

    Code:
    			keyp1 = wee;
    			keyp2 = how;
    			keyp3 = can;
    			keyp4 = do
    [/CODE]
  2. Sponsored Links
  3. 06-12-2018, 12:07 PM
    #2
    twistedkillas's Avatar
    twistedkillas
    I am error
    twistedkillas's Avatar
    twistedkillas
    I am error
    83
    Posts
    570
    Reputation
    Apr 2014
    NextGenUpdate
    man i figured someone would helped me by now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •