Skip to main content

Substring

  • What is it? This formula will split a string on the operator and return the part of the string before or after the first occurrence of the separator character.

Limitations

Substring only matches on the first occurance of the separator character, if more than one occurence of the separator character is present in the string this is included in the after section of the string.

Inputs

This formula has three inputs that should be set.

  • String the string to split
  • Return return the Before or After part of the string
  • Separator the string on which to split the passed string

Return values

ValueDescription
stringThe substring of the passed string

Note: return values are case sensitive

Formula Logic

This logic uses substr to return the before and after part of the string.

If return is set to before:

substr($this->value, 0, strpos($this->value, $this->separator));

If return is set to before:

substr($this->value, strpos($this->value, $this->separator) + strlen($this->separator));