a:=0;
while a:=pos(s,'-') do
begin
s:=copy(s,1,a-1)+copy(s,a+1,length(s)-a)
end;
while a:=pos(s,'-') do
begin
s:=copy(s,1,a-1)+copy(s,a+1,length(s)-a)
end;
解决方案 »
- 用delphi做前台,用access做后台的弊端
- delphi怎么把一个数据保留两位小数?
- 大数据量的计算速度问题
- 使用dbgrideh,adoquery的AFTEROPEN事件中定义了PICKLIST,但是运行后需要点击两次才会弹出下拉式框,是什么原因
- 再问TIdTCPClient SendBuffer方法。
- 为什么我关闭不了主窗体呢?!有源程序。
- 关于多Dll运行的问题
- VB和DELPHI那个更有前途,它们能赶得上C++吗!
- 怎样动态添加中文access2000库的中文字段类型???
- 关于DELPHI调用WEBSERVICE时,调试正常,正常执行报错!
- 如何恢复sql_server数据库,我只有MDF和ldf文件
- Delphi中如何设置能把一个工程的所有信息记录下来?如断点,书签等?
var s, tempstr : string;
i:integer;
begin
s:='111-222-333';
tempstr:='';
for i:=1 to Length(s) do
if s[i]='-' then
begin
showmessage(tempstr);
tempstr:='';
end
else
tempstr:=tempStr + s[i];
if tempstr<>'' then
showmessage(tempstr);
end;
Var nstart : Integer;
Begin
nstart := Pos( '-', src );
If nstart = 0 then strList.Add( src )
Else Begin
strList.Add( Copy( src, 1, nStart - 1 ) );
Delete( src, 1, nStart );
GetStrings( src );
End;
End;
i:integer;
str,substr:string;
begin
str:='song-dog-e4tt';
i:=pos(str,'-');
str:=copy(str,i+1,length(str));
i:=pos(str,'-');
substr:=copy(str,0,i-1) ;
end;
end;
Var
TStrings t;
Begin
t := TStringList.Create;
t.CommaText := 'a,b,c,d';
// 现在,t.Strings[0]即为'a',t.Strings[1]为'b',以此类推
t.Free;
End;
注意此方法对空格等也有效