如何检查字符串是否以c中的"GET"或"POST"开头?

use*_*729 -7 c string

请注意其中有空格.

我可以使用哪种功能?

Luk*_*keN 5

您可以使用

if (!strncmp("GET ", str, 4)
{ 
   ... 
} 
else if (!strncmp("POST ", str, 5)) 
{
   ...
} 
else
{
   ...
}
Run Code Online (Sandbox Code Playgroud)