1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

How to join the string after splitting

Discussion in 'C' started by spurthy04, Aug 4, 2011.

  1. spurthy04

    spurthy04 New Member

    Joined:
    Aug 4, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    HI,

    I have code where i've split the string "abc,cde,xyz" to abc cde and xyz using strtok.

    Now, I want to join it by adding single quote to each tokenised value.
    like 'abc','cde','xyz'.

    Can anyone help me ?

    Thanks,
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Code:
    sprintf(joined_string,"'%s','%s','%s'",str1,str2,str3);
    
     

Share This Page