[#boost-urls-url_view_base-userinfo] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url_view_base]::userinfo :relfileprefix: ../../../ :mrdocs: Return the userinfo == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L700[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/StringToken.adoc[StringToken] StringToken = xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/return_string.adoc[return_string]> StringToken::result_type userinfo(StringToken&& token = {}); ---- == Description If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. [NOTE] This function uses the string token return type customization. Depending on the token passed, the return type and behavior of the function can be different. See xref:boost/urls/string_token/return_string.adoc[string_token::return_string] for more information. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" ); ---- === Complexity Linear in `this‐>userinfo().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] Return the userinfo If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first. [NOTE] This function uses the string token return type customization. Depending on the token passed, the return type and behavior of the function can be different. See xref:boost/urls/string_token/return_string.adoc[string_token::return_string] for more information. === Example [,cpp] ---- assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" ); ---- === Complexity Linear in `this‐>userinfo().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- userinfo = user [ ":" [ password ] ] authority = [ userinfo "@" ] host [ ":" port ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)] == Return Value When called with no arguments, a value of type `std::string` is returned. Otherwise, the return type and meaning depends on the string token passed to the function. == See Also xref:boost/urls/url_view_base/has_password.adoc[has_password], xref:boost/urls/url_view_base/has_userinfo.adoc[has_userinfo], xref:boost/urls/url_view_base/encoded_password.adoc[encoded_password], xref:boost/urls/url_view_base/encoded_user.adoc[encoded_user], xref:boost/urls/url_view_base/encoded_userinfo.adoc[encoded_userinfo], xref:boost/urls/url_view_base/password.adoc[password], xref:boost/urls/url_view_base/user.adoc[user]. xref:boost/urls/url_view_base/has_password.adoc[has_password], xref:boost/urls/url_view_base/has_userinfo.adoc[has_userinfo], xref:boost/urls/url_view_base/encoded_password.adoc[encoded_password], xref:boost/urls/url_view_base/encoded_user.adoc[encoded_user], xref:boost/urls/url_view_base/encoded_userinfo.adoc[encoded_userinfo], xref:boost/urls/url_view_base/password.adoc[password], xref:boost/urls/url_view_base/user.adoc[user]. [.small]#Created with https://www.mrdocs.com[MrDocs]#