举例:abcdededaaaffgdgefgfg,从中截出d和f之间的串,f为d后面出现的第一个f,d为字符串中的第一个d,结果为ededaaa,怎样实现?
解决方案 »
- 怎样修改IE的类名?
- delphi 时间怎么转换成16进制
- 帮忙看条SQL语句谢谢!
- http://community.csdn.net/Expert/topic/3096/3096870.xml?temp=.2118341欢迎讨论
- 请问如何获得Outlook2000通讯录内的资料呢?
- 最近工作上不太爽,散分散分...
- 大家遇到这种情况吗(跟编程无关)!
- 什么问题,怎么解决?
- 谁想要我从网上下的病毒源程序?(TPVO3783,MONKEY,CIH等)
- 如何在DELPHI中获取某指定目录下的所以子目录及文件,200分,最好有详细代码
- 为什么我的笔记本装不上winnt4.0
- 请各位大侠,说一下delphi比较好的入门书籍(要有object pascal详细介绍)及经典好书!高分奉送!!!
result:=copy(s,pos('d',s)+1,pos('f',s)-pos('d',s));result就是结果字符串
Procedure TForm1.CopyDToF();
Var
Str,SubStr:String;
D_Pos,F_Pos:Integer;
Begin
Str:='abcdededaaaffgdgefgfg';
CharPos(Str,'d',1,D_Pos);
CharPos(Str,'f',D_Pos+1,f_Pos);
SubStr:=Copy(Str,D_pos+1,F_Pos-D_Pos-1);
Showmessage(Str+'#13'+SubStr);
End;Procedure TForm1.CharPos(Str,Char:String;StartPos:Integer;var FindPos:Integer);
Var
Str_L:integer;
Find:Boolean;
Begin
Find:=false;
FindPos:=Startpos;
While(not Find) do
Begin
FindPos:=FindPos+1;
if Str[FindPos]=Char then
Find:=true;
End;
End;
如果在第一个'd'以前有'f'咋办?