Changeset 5
- Timestamp:
- Jul 31, 2015, 11:43:28 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/linetime.lpr
r4 r5 28 28 TermString: string; 29 29 TermStringIndex: Integer; 30 function FindLineEnding(Buffer: string; var LineEndingLength: Integer): Integer; 30 31 procedure WriteRaw(Text: string); 31 32 procedure WriteLog(Text: string); … … 102 103 end; 103 104 105 function TMyApplication.FindLineEnding(Buffer: string; var LineEndingLength: Integer): Integer; 106 const 107 LineEnding1 = #13#10; 108 LineEnding2 = #10; 109 LineEnding3 = #13; 110 var 111 P: Integer; 112 begin 113 Result := 0; 114 LineEndingLength := 0; 115 116 P := Pos(LineEnding1, Buffer); 117 if (P > 0) and (((Result > 0) and (P < Result)) or (Result = 0)) then begin 118 Result := P; 119 LineEndingLength := Length(LineEnding1); 120 end; 121 P := Pos(LineEnding2, Buffer); 122 if (P > 0) and (((Result > 0) and (P < Result)) or (Result = 0)) then begin 123 Result := P; 124 LineEndingLength := Length(LineEnding2); 125 end; 126 P := Pos(LineEnding3, Buffer); 127 if (P > 0) and (((Result > 0) and (P < Result)) or (Result = 0)) then begin 128 Result := P; 129 LineEndingLength := Length(LineEnding3); 130 end; 131 end; 132 104 133 procedure TMyApplication.WriteRaw(Text: string); 105 134 begin … … 152 181 I: Integer; 153 182 Part: string; 183 LineEndingLength: Integer; 154 184 begin 155 185 repeat 156 P := Pos(LineEnding, Buffer);186 P := FindLineEnding(Buffer, LineEndingLength); 157 187 if P > 0 then begin 158 188 Part := Copy(Buffer, 1, P - 1); … … 160 190 Part := StringReplace(Part, '"', '""', [rfReplaceAll]); 161 191 PrintOutput(Part); 162 Delete(Buffer, 1, P + L ength(LineEnding)- 1);192 Delete(Buffer, 1, P + LineEndingLength - 1); 163 193 NewLine := True; 164 194 ShowTime := True;
Note:
See TracChangeset
for help on using the changeset viewer.