보여주신 자료 대로라면 이렇게 하면 되겠네요.
원하시는게 이게 맞는것 같은데요... 아닌가요? ^^;
procedure TForm1.Button1Click(Sender: TObject);
var
i,Len : Integer;
temp, ImsiData, Data : String;
begin
temp := '@a@,@,@b@,@c@,@d@,@@';
Len := Length(temp);
ImsiData := '';
for i := 1 to Len do
begin
if temp[i] <> '@' then ImsiData := ImsiData + temp[i];
end;
ImsiData := ImsiData+',';
Len := Length(ImsiData);
Data := '';
for i:= 1 to Len do
begin
if ImsiData[i] = ',' then
begin
if Data = '' then Memo1.Lines.Add('Data = 값없음')
else Memo1.Lines.Add('Data = '+ Data);
Data := '';
end
else Data := Data + ImsiData[i];
end;
end;
function StringReplace(const S, OldPattern, NewPattern: string;
Flags: TReplaceFlags): string;
var
SearchStr, Patt, NewStr: string;
Offset: Integer;
begin
if rfIgnoreCase in Flags then
begin
SearchStr := AnsiUpperCase(S);
Patt := AnsiUpperCase(OldPattern);
end else
begin
SearchStr := S;
Patt := OldPattern;
end;
NewStr := S;
Result := '';
while SearchStr <> '' do
begin
Offset := AnsiPos(Patt, SearchStr);
if Offset = 0 then
begin
Result := Result + NewStr;
Break;
end;
Result := Result + Copy(NewStr, 1, Offset - 1) + NewPattern;
NewStr := Copy(NewStr, Offset + Length(OldPattern), MaxInt);
if not (rfReplaceAll in Flags) then
begin
Result := Result + NewStr;
Break;
end;
SearchStr := Copy(SearchStr, Offset + Length(Patt), MaxInt);
end;
end;
원하시는게 이게 맞는것 같은데요... 아닌가요? ^^;
procedure TForm1.Button1Click(Sender: TObject);
var
i,Len : Integer;
temp, ImsiData, Data : String;
begin
temp := '@a@,@,@b@,@c@,@d@,@@';
Len := Length(temp);
ImsiData := '';
for i := 1 to Len do
begin
if temp[i] <> '@' then ImsiData := ImsiData + temp[i];
end;
ImsiData := ImsiData+',';
Len := Length(ImsiData);
Data := '';
for i:= 1 to Len do
begin
if ImsiData[i] = ',' then
begin
if Data = '' then Memo1.Lines.Add('Data = 값없음')
else Memo1.Lines.Add('Data = '+ Data);
Data := '';
end
else Data := Data + ImsiData[i];
end;
end;