String.prototype.after >= 0.1.2

Purpose

Return the string after the given needle

Syntax

String#after ( StringneedleBooleanfirst= true );

Parameters

needle

The string to look for

first

Get after the first occurrence or the last?

Return values

Examples

Get the string after the first occurence

'Get what we want'.after('what');
>>> " we want"

Return empty string when needle is not found

'The needle is not here'.after('unknown');
>>> ""

Get after the last occurrence

'Do you want this or do you want that?'.after('want', false);
>>> " that?"

Comments