📄 fbasfunction.pas
字号:
unit FBasFunction;
interface
Function Left(inString : String; numChars : Byte) : String;
Function Right(inString : String; numChars : Byte) : String;
Function SubStr(inString : String; numChars, strSize : Byte) : String;
implementation
{+-------------------------------------------------------+}
{: Function : LEFT :}
{+-------------------------------------------------------+}
{: Syntax : LEFT ( <expC> , <expN> ) :}
{: :}
{: where : <expC> = character string :}
{: <expN> = number of characters to return :}
{: Integer value :}
{: :}
{: Action : Returns a specified number of characters :}
{: in the character string <expC>, starting :}
{: from the leftmost character. :}
{: :}
{: Result Type : String :}
{+-------------------------------------------------------+}
Function Left;
Begin
Left := Copy(inString,1,numChars)
End;
{+-------------------------------------------------------+}
{: Function : RIGHT :}
{+-------------------------------------------------------+}
{: Syntax : RIGHT ( <expC> , <expN> ) :}
{: :}
{: where : <expC> = character string :}
{: <expN> = number of characters to return :}
{: Integer value :}
{: :}
{: Action : Returns the rightmost <expN> portion of a :}
{: character string <expC> :}
{: :}
{: Result Type : String :}
{+-------------------------------------------------------+}
Function Right;
Var
index : Byte;
Begin
If numChars >= Length(inString) Then
Right := inString
Else
Begin
index := Length(inString) - numChars+1;
Right := Copy(inString,index,numChars)
End
End;
{+-------------------------------------------------------+}
{: Function : SUBSTR :}
{+-------------------------------------------------------+}
{: Syntax : SUBSTR ( <expC>, <expN1>[, <expN2>] ) :}
{: :}
{: where : <expC> = character string :}
{: <expN1>,<expN2> = numeric value (Byte) :}
{: :}
{: Action : Returns a string of length <expN2> from :}
{: <expC>, beginning with the <expN1>th :}
{: character. The <expN1> and <expN2> must :}
{: be in the range 1 to 255. If <expN2> is :}
{: omitted or if there is fewer than <expN2> :}
{: characters to the right of the <expN1>th :}
{: character, all rightmost characters :}
{: beginning with the <expN1>th character are:}
{: returned. If <expN1> is greater than the :}
{: number of characters in <expC>, SUBSTR :}
{: returns a null string. :}
{: :}
{: Result Type : String :}
{+-------------------------------------------------------+}
Function SubStr;
Begin
SubStr := Copy(inString, numChars, StrSize );
End;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -