you can write
flag ? string : ""
more compactly as
string^flag
Don’t use it if you don’t like it, but it is harmless.