{***********************************************************************}
{									}
{ __SubStr    Extract substring from a string				}
{									}
{ function  __SubStr(Source : string; ChPos,Num : word) : string;	}
{									}
{	      Source	The string from which the substring is		}
{			extracted.					}
{	      ChPos	The starting position of the string to be	}
{			extracted.					}
{	      Num	The number of characters to extract from the	}
{			source string.					}
{									}
{ Description __SubStr returns the substring from Source starting at	}
{	      character position ChPos and Num characters long.  If	}
{	      ChPos is greater than the length of Source, or less than	}
{	      1, the null string is returned.				}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

function  __SubStr(Source : string; ChPos,Num : word) : string;

  var
    StartPos : word;

  begin {__SubStr}

    { Force a reasonable value for ChPos and then just call Copy.	}

    if (ChPos <= 0) then
       StartPos := 1
    else
       StartPos := ChPos;

    if (ChPos <= Length(Source)) then
       __SubStr := Copy(Source,StartPos,Num)
    else
       __SubStr := ''

  end;	{__SubStr}
