如何读出带文本中的以下字段:(FeeUser_ID)MSISDN ,(DestUser_ID)MSISDN,ActionID,ActionReasonID,SPServiceID,AccessMode,FeatureStr
文本格式:===================Trace=====================
SOAP Body:
MsgType: SyncOrderRelationReq
Version: 1.5.0
Send_Address:
DeviceType: 0
DeviceID: 999
Dest_Address:
DeviceType: 400
DeviceID: 917014
FeeUser_ID:
UserIDType: 1
MSISDN: 13823380009
PseudoCode: (null)
DestUser_ID:
UserIDType: 1
MSISDN: 13823380009
PseudoCode: (null)
LinkID: SP
ActionID: 1
ActionReasonID: 1
SPID: 917014
SPServiceID: 6102
AccessMode: 3
FeatureStr: (null)
===================Trace========================================Trace=====================
SOAP Body:
MsgType: SyncOrderRelationReq
Version: 1.5.0
Send_Address:
DeviceType: 0
DeviceID: 999
Dest_Address:
DeviceType: 400
DeviceID: 917014
FeeUser_ID:
UserIDType: 1
MSISDN: 13823380009
PseudoCode: (null)
DestUser_ID:
UserIDType: 1
MSISDN: 13823380009
PseudoCode: (null)
LinkID: SP
ActionID: 1
ActionReasonID: 1
SPID: 917014
SPServiceID: 6102
AccessMode: 3
FeatureStr: (null)
===================Trace=====================谢谢各位老大啊
文本格式:===================Trace=====================
SOAP Body:
MsgType: SyncOrderRelationReq
Version: 1.5.0
Send_Address:
DeviceType: 0
DeviceID: 999
Dest_Address:
DeviceType: 400
DeviceID: 917014
FeeUser_ID:
UserIDType: 1
MSISDN: 13823380009
PseudoCode: (null)
DestUser_ID:
UserIDType: 1
MSISDN: 13823380009
PseudoCode: (null)
LinkID: SP
ActionID: 1
ActionReasonID: 1
SPID: 917014
SPServiceID: 6102
AccessMode: 3
FeatureStr: (null)
===================Trace========================================Trace=====================
SOAP Body:
MsgType: SyncOrderRelationReq
Version: 1.5.0
Send_Address:
DeviceType: 0
DeviceID: 999
Dest_Address:
DeviceType: 400
DeviceID: 917014
FeeUser_ID:
UserIDType: 1
MSISDN: 13823380009
PseudoCode: (null)
DestUser_ID:
UserIDType: 1
MSISDN: 13823380009
PseudoCode: (null)
LinkID: SP
ActionID: 1
ActionReasonID: 1
SPID: 917014
SPServiceID: 6102
AccessMode: 3
FeatureStr: (null)
===================Trace=====================谢谢各位老大啊
解决方案 »
- 在BCB中如何实现DELPHI的Lengh( )函数?
- 很短的一段VC代码转D代码
- 如何在SQL语句里往ACCEESS传日期型变量?
- 采用socket连接方式的三层结构的一个问题
- ADO+ACCESS数据库,怎样在数据库中设字“金额”的数据类型,为什么我输入的只有两位小数,而在DBGRID中显示小数有好多位,打开MS ACCESS
- 如何判断memo里的行数超过了memo的高度?
- Delphi 用webbrowser来伪造网站来路问题?
- 关于Dbgrid的若干问题?
- 请教如何用程序判断ACCESS2000数据库中表的某个字段是否存在?
- 请问有什么好的DELPHI网站?
- 16进制转换成10进制的问题:
- 高人到此一试!
==========================?
不是很清楚你的意思
如果就是一个普通的文本文件,我觉得这样比较麻烦
因为文件中两个字段没关系
难道是赋值吗?用ini还可以
reset(f);
read(f,s); //接收字符串
closefile(f);
Expr: TRegExpr;
TS: TStrings;
begin
TS := TStringList.Create;
try
{ 读入文件 }
TS.LoadFromFile('文件名.txt');
{ 建立正则表达式对象 }
Expr := TRegExpr.Create;
{ 用于读取 (FeeUser_ID)MSISDN 的正则表达式 }
Expr.Expression := 'FeeUser_ID:.*?MSISDN: (\d+)';
try
{ 执行正则表达式匹配 }
Expr.Exec(moInput.Text);
{ 输出结果 }
Edit1.Text := Expr.Match[1]; // 这里是显示在 Edit1 上
finally
Expr.Free;
end;
finally
TS.Free;
end;
end;正则表达式类可在Delphi园地下载:
http://www.delphifans.com/SoftView/SoftView_500.html
Expr.Exec(moInput.Text);
改成
Expr.Exec(TS.Text);要读取其他内容,只要更换例子中的 Expr.Expression 即可,如下:用于读取 (DestUser_ID)MSISDN 的正则表达式:
Expr.Expression := 'DestUser_ID:.*?MSISDN: (\d+)';ActionID 的:
Expr.Expression := 'ActionID: (\d+)';ActionReasonID 的:
Expr.Expression := 'ActionReasonID: (\d+)';SPServiceID 的:
Expr.Expression := 'SPServiceID: (\d+)';AccessMode 的:
Expr.Expression := 'AccessMode: (\d+)';FeatureStr 的:
Expr.Expression := 'FeatureStr: ([^\n\r]*)';