LeftTillChStr Function
Returns the substring consisting of the characters from S up to but not including the specified one.

Unit
QESBPCSConvert

Declaration
Function LeftTillChStr(const S: string; const Ch: Char): string;

Description
If the specified character is not found then a null string is returned. Also See: LeftStr, RightAfterChStr, RightTillChStr

Parameters
the String from which the left substring is to be taken.
Ch the character that is searched for.

Category
Extra String Handling Routines

Implementation

function LeftTillChStr (const S: string; const Ch: Char): string;
var
     M: Integer;
begin
     M := ESBPosCh (Ch, S); // Find first position of Character
     if M < 2 then
          Result := '' // If not found or is in the first position return ''
     else
          Result := LeftStr (S, M - 1); // Otherwise return the Left portion
End;


HTML generated by Time2HELP
http://www.time2help.com