Modem response is string-package divided by commas.
You can:
- assign this string to TStringList.DelimitedText
to get collection of individual substrings
- identify package by 0-th item - here 'CUSD'
- get 1-th item as 'Crdit...'
Example with Memo.Lines
(of type TStrings
):
var
s: string;
sl: TStringList;
begin
s := '+CUSD: 0,"Crdit :1.33DA au 21/05/20.Credit offert :0DA",15';
sl := TStringList.Create;
try
sl.Delimiter := ',';
sl.StrictDelimiter := True;
sl.DelimitedText := s;
Memo1.Lines.Add(sl[1]);
finally
sl.Free;
result in sl:
+CUSD: 0
Crdit :1.33DA au 21/05/20.Credit offert :0DA
15
in Memo:
Crdit :1.33DA au 21/05/20.Credit offert :0DA
Crdit
, and copy the result from there. – LU RD Dec 3 at 14:21extractResultArr := StrUtils.SplitString(modemResponseStr,'"');
will give you the result inextractResultArr[1]
. – LU RD Dec 3 at 15:37If the response contain " then do the treatment you gave me
how can i do that in Delphi ? here is the RxChar function:procedure var arr : TArray<String>; s : String; begin CPOoredoo.ReadStr(str, Count); arr := StrUtils.SplitString(str,'"'); memo1.Lines.Add(arr[1]); end;
– Kimber Dec 3 at 22:22if Pos('"',str) > 0) then ...
will tell you if the"
character is in the response. – LU RD Dec 3 at 22:43