|
字符串函数大全(5) Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function RandomFrom(const AValues: array of string): string; overload; $[StrUtils.pas 功能 随机返回字符串数组AValues中的一个元素 说明 之前建议执行Randomize 参考 function System.Random 例子 Randomize; Edit3.Text := RandomFrom(['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IfThen(AValue: Boolean; const ATrue: string; AFalse: string = ''): string; overload; $[StrUtils.pas 功能 返回指定的逻辑字符串 说明 IfThen(True, '是', '否') = '是';IfThen(False, '是', '否') = '否' 参考 <NULL> 例子 Edit3.Text := IfThen(CheckBox1.Checked, Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LeftStr(const AText: string; const ACount: Integer): string; $[StrUtils.pas 功能 返回字符串AText左边的ACount个字符 说明 LeftStr('123456', 3) = '123' 参考 function System.Copy 例子 Edit3.Text := LeftStr(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function RightStr(const AText: string; const ACount: Integer): string; $[StrUtils.pas 功能 返回字符串AText右边的ACount个字符 说明 RightStr('123456', 3) = '456' 参考 function System.Copy 例子 Edit3.Text := RightStr(Edit1.Text, SpinEdit1.Value);
|