Identifying a period at the end of a string

I want to end a loop if a string ends with a period. A period in any other place should not end the string. How can this be achieved? I know how to find a period within a string, but can't figure out how to determine if the period is the last character. Any tips would be greatly appreciated.
if (!str.empty() && str[str.length()-1]=='.') ...
Thanks, I will give that a try
Topic archived. No new replies allowed.