举例:
字符串A是 a/b/c/d/e/f字符串B是 a/c/f
字符串C是 b/e
字符串D是 b/g/c怎么用Delphi判断:字符串B包含于A内,字符串C也是包含于A内,字符串D不包含在A内呢?最好有个代码供我研究,多谢大家啦!
字符串A是 a/b/c/d/e/f字符串B是 a/c/f
字符串C是 b/e
字符串D是 b/g/c怎么用Delphi判断:字符串B包含于A内,字符串C也是包含于A内,字符串D不包含在A内呢?最好有个代码供我研究,多谢大家啦!
解决方案 »
- 提示 Canvas don 't allow drawing错误
- 如何使用TWEbBrower控件动态得到网页中的内容和DIV属性?
- 求 dbcombobox控件
- 在MIDAS中如何处理数据的封包和解包啊
- 有一小问题_我打开别人的源码时,在设计时看不到主窗体?
- 怎样忽略掉这个系统级错误?
- 高分送上 MS Development Encironment 怎么安装?
- 急救啊,大家帮我看看,下面到底出错在哪里,小弟初学不久
- 急急急:OLE注册的问题
- ACCESS2000为什么 create table 表1 (字段1 single default 0) 提示default出错误
- 哪为愿意解答我的问题
- VC++6.0源码改成delphi源码,急呀!
function funcA(A, B: string): Boolean;
var
i:Integer;
AList: TStringList;
begin
Result := True;
AList := TStringList.Create;
AList.Delimiter := '/';
AList.DelimitedText := B;
for i := 0 to AList.Count - 1 do
beign
Result := pos(AList[I], A) > 0;
if not Result then Break;
end;
end;
var
P1, P2: PChar;
begin
P1 := PChar(SubStr);
while P1^ <> #0 do
begin
P2 := PChar(Str);
while P2^ <> #0 do
begin
if P2^ = P1^ then
Break;
Inc(P2)
end;
if P2^ = #0 then
begin
Result := False;
Exit
end;
Inc(P1);
end;
Result := True
end;procedure TForm1.FormCreate(Sender: TObject);
begin
if Contains('a/b/c/d/e/f', 'b/c') then
ShowMessage('')
end;
function funcA(A, B: string): Boolean;
var
i:Integer;
AList: TStringList;
begin
Result := True;
AList := TStringList.Create;
AList.Delimiter := '/';
AList.DelimitedText := B;
for i := 0 to AList.Count - 1 do
begin
Result := pos(AList[I], A) > 0;
if not Result then Break
else A:=copy(A,pos(AList[I], A)+1,length(A)-pos(AList[I], A)); //比如:该字符串a/c/c/d是不在字符串A中的,是吧?
end;
end;