[#BloombergLP-bdls-PathUtil-getLeaf-0e]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/PathUtil.adoc[PathUtil]::getLeaf
:relfileprefix: ../../../
:mrdocs:

Load into the specified `leaf` the value of the rightmost name in the specified `path` that follows the root&semi; that is, the leaf element&period; If the optionally specified `rootEnd` offset is non&hyphen;negative, it is taken as the position in `path` of the character following the root&period; Return 0 on success, and a non&hyphen;zero value otherwise&semi; in particular, return nonzero if `path` does not have a leaf&period; Note that `getBasename` is a synonym for `getLeaf`&period; See &lsqb;&rsqb;and Performance)&period; See also  for the definition of leaf and root&period;

== Synopsis

Declared in `&lt;bdls&lowbar;pathutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
getLeaf(
    xref:bsl/string.adoc[bsl::string]* leaf,
    std::string&lowbar;view const& path,
    int rootEnd = &hyphen;1);
----


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