NAME

Mojo::Autobox::String - Autobox string methods for Mojo::Autobox

SYNOPSIS

use Mojo::Autobox;

# "Trimmed"
'  Trimmed  '->byte_stream->trim;

# "Text"
'<p>Text</p>'->dom->at('p')->text;

# "world"
'{"hello": "world"}'->json->{hello};

# "anchor"
'http://mysite.com/path#anchor'->url->fragment;

DESCRIPTION

String methods for Mojo::Autobox.

METHODS

byte_stream

Returns an instance of Mojo::ByteStream, constructed from the invocant string.

b

An alias for "byte_stream".

dom

Returns an instance of Mojo::DOM, constructed from the invocant string. Optionally takes a CSS3 selector which is passed to the Mojo::DOM instance's find method.

json

Parses the invocant string as JSON using "decode_json" in Mojo::JSON and returns the result. Optionally takes a JSON pointer used to delve into the resulting structure using Mojo::JSON::Pointer.

j

An alias for "json".

url

Returns an instance of Mojo::URL, constructed from the invocant string.