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

C/C++ API Documentation | 2026.1

# StrOps::Words( StrBuf &, const char *[], char *[], int )

Break a string apart at whitespace.

Virtual? | No |
Class | `StrOps` |
Arguments | `StrBuf &tmp` | a temporary string
| `const char *buf` | the input string
| `char *vec[]` | the output array
| `int maxVec` | the maximum number of words to handle
Returns | `int` | the actual number of words handled

## Notes

This function uses the `isAspace()` function to define whitespace.

## Example

Copy

    StrBuf o = StrBuf();
    StrBuf tmp = StrBuf();
    o.Set( "abc\tdef   ghi\nxyz xyzzy plugh" );

    printf( "Input StrBuf:\n%s\n", o.Text() );

    char *vec[5];
    int w = StrOps::Words( tmp, o, vec, 5 );

    for ( ; w ; w-- )
    {
        printf( "Word %d: %s\n", w, vec[w-1] );
    }

    return 0;

Executing the preceding code produces the following output:

    Input StrBuf:
    abc     def   ghi
    xyz xyzzy plugh

    Word 5: xyzzy
    Word 4: xyz
    Word 3: ghi
    Word 2: def
    Word 1: abc

Your search for returned results