Skip to content
Reference > Methods

strAfterLast(text,toFind,origIfNotFound)

Definition

String strAfterLast(String text, String toFind, Boolean origIfNotFound)

Description

Returns the portion of a string after the last occurence of a delimiter. If the delimiter is not found, then returns either the original string or null depending on origIfNotFound param.

Parameter Definition

Name Type Description
text String The base string to get a substring from
toFind String the delimiter to find
origIfNotFound Boolean If the toFind parameter doesn't exist in the text: then return text if true or null if false

Examples

1
2
3
4
5
6
7
String r1 = strAfterLast("What now"," ",true); // r1 == now
String r2 = strAfterLast("what,now"," ",true); // r2 == what,now
Object r3 = strAfterLast("what,now"," ",false); // r3 == null
Object r4 = strAfterLast("what,now",null,false); // r4 == null
String r5 = strAfterLast("what,now",null,true); // r5 == what,now
Object r6 = strAfterLast(null," ",false); // r6 == null
String r7 = strAfterLast("An example,of, multiple, delims",", ",true); // r7 == delims