Find end of string when it has many trailing nulls

I have a string that has a bunch of trailing nulls. How can I find the index of the first null?

I am currently using string.length(), but that seems to return the last null.

A copy of that string is also contained in a char buffer also with trailing nulls. So if it is easier to find that first null index that would also solve my problem.

Thanks
Frank

I finally was able to find a solution...using strlen(char buffer) seems to work well.