小弟现在遇到一个问题,其实很简单,就是将文本框中输入的字符串在遇到逗号,空格时进行分割是更小的字符串,由于小弟我早将PALSCAL忘记多年,而且现在事情又很急,所以有劳各位大虾了,先谢了!!!
解决方案 »
- delphi调用winexec.exe文件执行解压缩,为什么解压以后把多个文件夹中的内容就存放在一个文件夹中。也没有其他文件夹了。请问有办法解决??
- Delphi中ADO连接MS SQL Servel 2000 数据库的问题
- 在Delphi里进行SQL Server 2000数据库创建和还原的问题
- 大家帮忙看一下这个问题吧…
- 谁有我晚,啊……哈…哈哈~~~~~
- 如何在delphi中实现对文件进行base64编码
- 请问我现在是98/2000sever双系统,如果直接再装一个2000server可以吗?
- ★★如何更改inputbox中信息内容部分的字体,及如何约束输入的类型?
- 大家都来看,我们老板说得对不对?
- 请问哪里有关于Delphi的网站?
- 不好意思,我问一首Beyond 歌名
- 请推荐一个分析代码片断执行时间的工具
var
i,j:integer;
begin
result:=tstringlist.create;
i:= Pos(s,',');
j:= Pos(s,' ');
if ((i<j) and (i <>0 )) or (j ==0) then j:= i;
while k do
begin
result.add(s,1,k);
s:= copy (s,k+1,length(s) - k);
i:= Pos(s,',');
j:= Pos(s,' ');
if ((i<j) and (i <>0 )) or (j ==0) then j:= i;
end;
end;
function ListCount(mList: String; mDelimiter: String): Integer;
function ListValue(mList: String; mIndex: Integer; mDelimiter: String =','): String;
function PosEx(Substr: string; S: string): Integer;implementationuses
Windows;//============================ StrLeft =====================================//
function StrLeft(const mStr: string; mDelimiter: string): string;
{ 返回左分隔字符串 }
begin
Result := Copy(mStr, 1, Pos(mDelimiter, mStr) - 1);
end;//=========================== ListCount =====================================//
function ListCount(mList: string; mDelimiter: string ): Integer;
{ 返回列表数 }
var
I, L: Integer;
mListC:String;
begin
Result := 0;
if mList = '' then Exit;
mListC := mList;
L := Length(mList);
I := Pos(mDelimiter , mList);
while I > 0 do begin
mList := Copy(mList , I + Length(mDelimiter), L);
I := Pos(mDelimiter , mList);
Inc(Result);
end;
Inc(Result);
if PChar(mListC)[0] = mDelimiter then
Result := Result - 1;
if PChar(mListc)[Length(mListc)-1] = mDelimiter then
Result := Result - 1;
end;//============================= ListValue ==================================//
function ListValue(mList: string; mIndex: Integer; mDelimiter: string = ','): string;
{ 返回列表指定位置的元素 }
var
I, L, K: Integer;
begin
if Pchar(mList)[Length(mList)-1] <> mDelimiter then
mList:=mList + mDelimiter;
L := Length(mList);
I := Pos(mDelimiter, mList);
K := 0;
Result := '';
while (I > 0) and (K <> mIndex) do begin
mList := Copy(mList, I + Length(mDelimiter), L);
I := Pos(mDelimiter, mList);
Inc(K);
end;
if K = mIndex then
Result := StrLeft(mList + mDelimiter, mDelimiter);
end;//=============================== PosEx =====================================//
function PosEx(Substr: string; S: string): Integer;
var
CharMap: array [Char] of Char;
I, J: Integer;
Ps: Pchar;
Mark: Boolean;
C: Char;
begin
Result := 0;
for C := Low(CharMap) to High(CharMap) do CharMap[C] := C;
AnsiUpperBuff(PChar(@CharMap), sizeof(CharMap));
AnsiUpperBuff(@Substr[1], Length(Substr));
Ps := PChar(S);
for I := 1 to Length(S) do
begin
if CharMap[(Ps + I - 1)^] = SubStr[1] then
begin
Mark := True;
for J := 1 to Length(Substr) do
begin
if Charmap[(Ps + I + J - 2)^] <> SubStr[J] then
begin
Mark := False;
Break;
end;
end;
if Mark then
begin
Result := I;
Break;
end;
end;
end;
end;end.
你不会不会使用吧....