I recently had to write a program where it should perform a certain action only when there was a letter 'a' in the string. I ended up using something like:
but my question is, is there a more efficient way to find out if a string contains a certain character? I would have thought that if there is npos there should be something like pos so you could do:Code:if (b.find('A')!=npos) return b;
Any help is greatly appreciated.Code:if (b.find('A') == pos) return b;