C: evaluate part of the string

Posted by Halst on Stack Overflow See other posts from Stack Overflow or by Halst
Published on 2010-04-07T19:33:55Z Indexed on 2010/04/07 19:43 UTC
Read the original article Hit count: 399

I cant find an expression to evaluate a part of a string.

I want to get something like that:

if (string[4:8]=='abc') {...}

I started writing like this:

if (string[4]=='a' && string[5]=='b' && string[6]=='c') {...}

but if i need to evaluate a big part of string like

if (string[10:40] == another_string) {...}

then it gets to write TOO much expressions. Are there any ready-to-use solutions?

© Stack Overflow or respective owner

Related posts about c

    Related posts about string