有这样一个字符
temp:='a = ''2'' or b = ''3'' and c = ''4'' or d = ''5'''
字符or 跟 and 是之间位置是随意调换
请问现在如何把字符temp分割成
a='2' or
b='3' and
c='4' or
d='5
谢谢!
temp:='a = ''2'' or b = ''3'' and c = ''4'' or d = ''5'''
字符or 跟 and 是之间位置是随意调换
请问现在如何把字符temp分割成
a='2' or
b='3' and
c='4' or
d='5
谢谢!
解决方案 »
- DELPHI5编译的东西在DELPHI7下打开出现乱码,请帮忙看看谢谢!
- 关于使用IdFtp上传文件的问题,请指教!
- 一个不要钱的电子书站,真的,不错的,挺全面的
- 坚决抵制日货、韩货,买日货是一种耻辱,买韩货是没有责任心、没有危机感!!!!!!
- 巨简单,但我忘记了,二维常量数组如何声明问题?在线等
- 关于窗体继承?
- 使用Database Desktop的问题~~
- 请问如何让程序添加到启动菜单中?
- 如何给DELPHI6打补丁
- 简单问题,白送分了.请ActiveX控件是什么呢?
- 急急,数据库操作出现list index out of bounds(0) 错误
- 调用webservice方法的时候怎么把附件发送过去
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm13 = class(TForm)
edt1: TEdit;
btn1: TButton;
mmo1: TMemo;
procedure btn1Click(Sender: TObject);
private
procedure Split_And(Str : string);
{ Private declarations }
public
{ Public declarations }
end;var
Form13: TForm13;implementation
const
S_OR = ' or ';
S_AND = ' and ';
{$R *.dfm}
procedure TForm13.Split_And(Str : string);
procedure Split_Or(Str : string);
var
index : integer;
begin
index := Pos(S_OR, Str);
while index > 0 do
begin
mmo1.Lines.Add(Copy(Str, 1, index + Length(S_OR) - 1));
Str := Copy(Str, index + Length(S_OR), Length(Str));
index := Pos(S_OR, Str);
end;
mmo1.Lines.Add(Str);
end;
var
index : integer;
begin
index := Pos(S_AND, Str);
while index > 0 do
begin
Split_Or(Copy(Str, 1, index + Length(S_AND) - 1));
Str := Copy(Str, index + Length(S_AND), Length(Str));
index := Pos(S_AND, Str);
end;
Split_Or(Str);
end;procedure TForm13.btn1Click(Sender: TObject);
begin
mmo1.Clear;
Split_And(edt1.Text);
end;end.