小编rad*_*r75的帖子

检查c中字符串的最后一个字符

如果我有两种类型的字符串:

const char *str1 = "This is a string with \"quotes escaped at the end\""; 
const char *str2 = "This is a \"string\" without quotes at the end"; 

testFn(str1);
testFn(str2);

int testFn(const char *str)
{
  // test & return 1 if ends on no quote
  // test & return 0 if ends on quote
  return;
}
Run Code Online (Sandbox Code Playgroud)

我想测试字符串是否以引号"结束"

什么是测试这个的好方法?谢谢

c string

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

c ×1

string ×1