[#BloombergLP-bdlb-String-copy-01]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/String.adoc[String]::copy
:relfileprefix: ../../../
:mrdocs:

Return a newly allocated null&hyphen;terminated copy of `string`&period;

== Synopses

Declared in `&lt;bdlb&lowbar;string&period;h&gt;`

Return a newly allocated null&hyphen;terminated copy of `string`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
char*
xref:BloombergLP/bdlb/String/copy-0d.adoc[copy](
    xref:bsl/string.adoc[bsl::string] const& string,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator);
----

[.small]#xref:BloombergLP/bdlb/String/copy-0d.adoc[_» more&period;&period;&period;_]#

Return a newly allocated null&hyphen;terminated copy of `string`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
char*
xref:BloombergLP/bdlb/String/copy-0eb.adoc[copy](
    char const* string,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator);
----

[.small]#xref:BloombergLP/bdlb/String/copy-0eb.adoc[_» more&period;&period;&period;_]#

Return a newly allocated null&hyphen;terminated copy of `string`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
char*
xref:BloombergLP/bdlb/String/copy-0e0.adoc[copy](
    char const* string,
    int length,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator);
----

[.small]#xref:BloombergLP/bdlb/String/copy-0e0.adoc[_» more&period;&period;&period;_]#

== Return Value

address of the newly allocated copy

== Parameters

[cols="1,4"]
|===
| Name| Description
| *string*
| string to copy
| *basicAllocator*
| allocator used to supply memory
| *length*
| length of `string` in bytes
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
