/ LJCPHPCodeDoc / LJCCommonLib / LJCCommon / GetDelimitedString


Parameters
$text - The text to be parsed.
$beginDelimiter - The beginning delimiter.
$endDelimiter - The ending delimiter.
$lTrim - Indicates if the parsed value is to be left trimmed.
$rTrim - Indicates if the parsed value is to be right trimmed.

Returns

The parsed value.

Syntax

PHP
public static function GetDelimitedString(string $text, string $beginDelimiter
, ?string $endDelimiter, bool $lTrim = true, bool $rTrim = true) : ?string

Gets the string between the delimiters. (E)

Remarks

Returns null if the begin delimiter is not found.

Includes to the end of the string if the end delimiter is null or not found.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCCommonLib.php";
 
 // $text = "here"
 $text = LJCCommon::GetDelimitedString("This | here |.", "|", "|");

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.