Delphi 字符串操作
常忘记,在此做笔记。
这几个函数都包含在StrUtils中,所以需要uses StrUtils;
假设字符串是 Dstr := ’Delphi is the BEST’, 那么
LeftStr(Dstr, 5) := ’Delph’
MidStr(Dstr, 6, 7) := ’i is th’
RightStr(Dstr, 6) := ’e BEST’
~~~~~~~~~~~~~~~~~~~~~~~~~
function RightStr
(Const Str: String; Size: Word): String;
begin
if Size > Length(Str) then Size := Length(Str) ;
RightStr := Copy(Str, Length(Str)-Size+1, Size)
end;
function MidStr
(Const Str: String; from, Size: Word): String;
begin
MidStr := Copy(Str, from, Size)
end;
function LeftStr
(Const Str: String; Size: Word): String;
begin
LeftStr := Copy(Str, 1, Size)
end;
这几个函数经常结合Pos, Length, Copy使用
拆分字符串的函数 [2005-12-13]
delphi中没有提供此类函数,从大富翁找了一个
function split(src,dec : string):TStringList;
var
i : integer;
str : string;
begin
result := TStringList.Create;
repeat
i := pos(dec,src);
str := copy(src,1,i-1);
if (str='') and (i>0) then
begin
delete(src,1,length(dec));
continue;
end;
if i
相关文档:
procedure mc_SplitStr(sourStr:String;splitChar:String;desLst:TStringList);
var
tmpStr:String;
sValue:String;
iStart,iPos:Integer;
begin
try
desLst.Clear; //很重要,否则,会一 ......
TreeView由节点构成,建树通过对TreeView.items属性进行操作。Items是一个TTreeNodes对象,这是一个TTreeNode集。
一、针对TTreeNodes,也就是 TreeView.Items,有这些属性:
1、count,节点个数。
2、item[index] ,通过index得到节点。
二、针对TTreeNodes,也就是 TreeView.Items,常用的添加节点的操作有:
Add ......
這個界面是用PB做的,delphi如何設實現呢,想用dbControlGrid來實現(好像也做不到),
問題是如何實現不同生產類別顯示出來的方式不一樣
......
概要
自去年CodeGear被英巴卡迪诺(Embarcadero Technologies)收购后,大家对Delphi的未来发展非常关心。近日,InfoQ中文站有幸对David I进行了独家专访,以了解更多关于Delphi的相关信息。
个人简介
David Intersimone(简称David I),英巴卡迪诺负责开发者关系的副总裁和首席宣传官(Chief Evangelist)。David负 ......
Delphi中为DBGrid控件添加色彩
2005-08-08 09:13作者:小刀轻舞出处:天极网责任编辑:方舟
添加不同颜色到TDBGrid组件中将会增强组件的显示外观和区别数据库中不同内容的行或列。
TDBGrid组件是一种非常棒的用来显示数据内容的组件,本文的重点将用来解释---如何在TDB ......