Is there an F() macro for strings defined within a string compare function

I have a number of string compare functions in one of my Arduino programs, where the comparison string is defined inside the function call .

int val = strcmp("this would be the string im looking for but this definition its very long and seems to consume RAM - how to avoid?", strvar);

I can see that when I have a bunch of these types of statements that the compiler reports that I'm using more RAM as I add more statements.

My question is, is there an F() type macro that can be used for string comparisons, so that I can avoid using up most of my available RAM.

I think you can use strcmp_P for the progmem version of strcmp and then use PSTR to put the string in flash.

You can use strcmp_P() , where the second parameter is a PROGMEM pointer.

The usage would be like this, with F():

int val = strcmp_P(strval,(PGM_P) F("some string to test"));

The PGM_P type is a pointer to PROGMEM.

thank you. would that also work for strncasecmp()?

Yes, with strncasecmp_P().

See this for all the PROGMEM functions

great. thanks for you help.