c - Can't catch apostrophe in if statement -
i creating program takes text file, , word. reads text file , compares word current word being read. way built ignore "'s". example if searching "nasa" , came across word "nasa's", read "nasa". unfortunately can't catch apostrophe using "if (ch == ''\')", "ch" being current char. reason being maybe because apostrophes in text file ’. don't know how accommodate that.
here's have catch apostrophe:
else if (ch == '\'') { #if 1 printf("comparing apostrophe\n"); #endif continue; } please note part of bigger program, not allowed show you. explains "else if" ion beginning.
thanks.
if apostrophes '’', should check '’' character, won't you. that's different character - looks extended ascii character 146 (decimal), "right single quotation mark". text came ms office - loves convert single , double quotes single , double so-called "smart" quotes (which, if you're doing text outside of office, but.) , has been pointed out, "left single quotation mark", ascii character 145, other half of same set, there might of in text well. i.e.:
else if (ch == '\'' || ch == '’' || ch == '‘') { [do stuff] }
Comments
Post a Comment