String.substringBefore()

Signature

String substringBefore (String s1, String s2)

Domain

action, condition

Description

Returns the substring of the first parameter string s1 that precedes the first occurence of the second parameter string s2 in the first parameter sting s1 or null if the first parameter string s1 does not contain the second parameter string s2.

Parameters

NameTypeDescription
s1StringA String to test.
s2StringA String to search for in String s1.

Returns

TypeDescription
StringThe result String.

Cautions

none

Example


String result = String.substringBefore ("Hello world", "orl");

Result is:
result 'Hello w'