And if the string has 3 quotation marks at the beginning or 2 at the end?
This isn't actually a problem for my specific need, but it is always helpful to study code you don't understand. So I think I am going to use the simple method and shift the characters over.
Here is my final function:
Code:
int Remove_Outer
(
char *String,
const char Outer
){
int Last_Index = strlen(String) - 1;
if(Last_Index < 0)
return FAILURE;
if(String[0] != Outer || String[Last_Index] != Outer)
return FAILURE;
String[Last_Index] = '\0';
for(int i = 1;i <= Last_Index;i++)
String[i - 1] = String[i];
return SUCCESS;
}
Thanks again for all of the help.
Edit: Is it possible to use bit shifting to accomplish this as well?