Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2026.1

# StrPtr::Atoi()

Return the numeric value, if any, represented by this `StrPtr`'s buffer.

Virtual? | No |
Class | `StrPtr` |
Arguments | None |
Returns | `int` | integer value of the string

## Notes

`StrPtr::Atoi()` is equivalent to calling `atoi(``StrPtr::Text()``)`. Non-numeric strings typically return a value of zero.

## Example

Copy

    #include &lt;stdhdrs.h&gt;
    #include &lt;strbuf.h&gt;

    int main( int argc, char **argv )
    {
        StrBuf str1;
        StrBuf str2;

        str1.Set( "123" );
        str2.Set( "234" );

        printf( "%s + %s = %d\n",
            str1.Text(), str2.Text(), str1.Atoi() + str2.Atoi() );
    }

Executing the preceding code produces the following output:

    123 + 234 = 357

Your search for returned results