:relfileprefix: ../../../
[#FE86BAC192441BCE7627D622D4B4259EAD67D6D3]

= Function url_view_base::user

pass:v,q[Return the user]


== Synopsis

Declared in header `</boost/url/url_view_base.hpp#L793[boost/url/url_view_base.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<class StringToken = xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/return_string.adoc[return_string]>
StringToken::result_type
user(StringToken&& token) const;
----

== Description

pass:v,q[If present, this function returns a] pass:v,q[string representing the user (which]
pass:v,q[may be empty).]
pass:v,q[Otherwise it returns an empty string.]
pass:v,q[Any percent-escapes in the string are]
pass:v,q[decoded first.]

=== Example
[,cpp]
----
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
----

=== Complexity
pass:v,q[Linear in `this->user().size()`.]

=== Exception Safety
pass:v,q[Calls to allocate may throw.]

=== BNF
[,cpp]
----
userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)]



== Return Value

* `result_type` 


== Parameters

|===
| Name | Type 

| *token*
| ``

|===



