Copy characters from this string into a character buffer.

Synopsis

Declared in <bslstl_string.h>

size_type
copy(
    CHAR_TYPE* characterString,
    size_type numChars,
    size_type position = 0) const;

Description

Copy from this string, starting from the optionally specified position, the specified numChars or length() ‐ position characters, whichever is smaller, into the specified characterString buffer, and return the number of characters copied. If position is not specified, 0 is used. Throw out_of_range if `position > length(). The behavior is undefined unless `characterString` is at least `numChars long. Note that the output characterString is not null‐terminated.

Return Value

number of characters copied into the destination buffer

Parameters

Name

Description

characterString

pointer to characters

numChars

number of characters

position

starting index

Created with MrDocs