boost::urls::url_base::set_scheme :: Boost Libraries Documentation

# boost::urls::url_base::set_scheme

Set the scheme

## Synopsis

Declared in `<boost/url/url_base.hpp>`

    url_base&
    set_scheme(core::string_view s);

## Description

The scheme is set to the specified string, which must contain a valid scheme without any trailing colon (':'). Note that schemes are case‐insensitive, and the canonical form is lowercased.

## Example

    assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https );

## Complexity

Linear in `this‐>size() + s.size()`.

## Exception Safety

Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

## BNF

    scheme        = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

## Specification

- 3.1. Scheme (rfc3986)

## Exceptions

Name | Thrown on
`system_error` | `s` contains an invalid scheme.

## Return Value

`*this`

## Parameters

Name | Description
--- | ---
s | The scheme to set.

## See Also

`remove_scheme`.

Created with MrDocs