Reference > Methods
strBefore(text,toFind,origIfNotFound)
Definition
String strBefore(String text, String toFind, Boolean origIfNotFound )
Description
Returns the portion of a string before the first occurence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param.
Parameter Definition
Examples
String r1 = strBefore("What now"," ",true); // r1 == What
String r2 = strBefore("what,now"," ",true); // r2 == what,now
Object r3 = strBefore("what,now"," ",false); // r3 == null
Object r4 = strBefore("what,now",null,false); // r4 == null
String r5 = strBefore("what,now",null,true); // r5 == what,now
Object r6 = strBefore(null," ",false); // r6 == null
String r7 = strBefore("An example,of, multiple, delims",", ",true); // r7 == An example,of