brapbboom
brapbboom

Reputation: 69

C how to remove double quotes in a string?

I am trying to remove double quotes using strtok() in C. My string contains "b" but I want the double quotes to be removed. Whenever I used strtok() all I can remove is the second double quote.

Output:

"b

Desired Output:

b

My attempt:

strtok(inttbo[ctr].value1, "\"\"");

Upvotes: 0

Views: 2607

Answers (1)

Sagar Chand
Sagar Chand

Reputation: 260

Though not the best way, but you can try this.

Since it is C, your string must be stored in an array. So instead of printing it from 0th index, print from first index.

OR

copy string using strncpy to another string from 1st index and then print

Upvotes: 1

Related Questions