Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   C Function to sort a string based on a delimiter (http://www.go4expert.com/forums/c-function-sort-string-based-delimiter-t28144/)

mehimadri 7Apr2012 11:51

C Function to sort a string based on a delimiter
 
I Need to write a function using C wherein I should do the following:
(i) The function will receive a string in a character pointer
(ii) This string will adhere to the following structure:
"Kentucky+New York+Arizona+Nevada"
The number of states can differ from 4 to 50
The delimiter between States can differ from '+' to ',', hence I would like to pass
the delimiter to the function.
(iii) This string should then be sorted alphabetically from left to right.
The above example would then become:
"Arizona+Kentucky+Nevada+New York"
(iv) This string needs to be returned from the function using a character pointer.
Please help me in this.

xpi0t0s 17Apr2012 16:03

Re: C Function to sort a string based on a delimiter
 
How far have you got and where are you stuck?


All times are GMT +5.5. The time now is 03:56.