[#BloombergLP-bdlb-String-copy-0eb] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/String.adoc[String]::copy :relfileprefix: ../../../ :mrdocs: Return a newly allocated null‐terminated copy of `string`. == Synopsis Declared in `<bdlb_string.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static char* copy( char const* string, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator); ---- == Description Create a null‐terminated copy of the specified `string`, using the specified `basicAllocator` to supply memory, and return the address of the newly‐created modifiable string. The string that is returned is owned by the caller. The behavior is undefined unless `bsl::strlen(string) <= INT_MAX` and `basicAllocator` is non‐null. == Return Value address of the newly allocated copy == Parameters [cols="1,4"] |=== | Name| Description | *string* | null‐terminated string to copy | *basicAllocator* | allocator used to supply memory |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#