Elementals.js

Latest Version: 3.4 PRODUCTION 18 November 2017

Method String.strFrom

Summary:

Finds a character in a string and returns the rest of the string from after that point.

Calling Convention:
String.strFrom(character[, fromLast])
Parameters
character
The character to match in this string.
fromLast Optional
If loose true, the last matching character will be used instead of the first. Handy for detecting file extensions.
Returns:
The remainder of the string AFTER the matched character if found. If there is no match a boolean false is returned.

JavaScript

console.log(String('testfile.test.txt').strFrom('.')); // 'test.txt'
console.log(String('testfile.test.txt').strFrom('.', true)); // 'txt'
console.log(String('testfile.test.txt').strFrom('@')); // boolean false

Advertisement