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

C/C++ API Documentation | 2026.1

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

Break a string apart at line breaks.

Virtual? | No |
Class | `StrOps` |
Arguments | `StrBuf &o` | the input string
| `char *vec[]` | the output array
| `int maxVec` | the maximum number of lines to handle
Returns | `int` | the actual number of lines handled

## Notes

This function handles all types of line breaks: “\r”, “\n”, and “\r\n”.

## Example

Copy

    StrBuf o = StrBuf();
    o.Set( "abc\ndef\nghi\n" );

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

    char *vec[4];
    int l = StrOps::Lines( o, vec, 4 );

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

Executing the preceding code produces the following output:

Copy

    Input StrBuf:
    abc
    def
    ghi

    Line 3: abc
    Line 2: def
    Line 1: ghi

Your search for returned results