changeset 15961 | 4ad8dd66d9d5 |
parent 15960 | 79b1129b4d03 |
15960:79b1129b4d03 | 15961:4ad8dd66d9d5 |
---|---|
164 8: curArg:= arg9; |
164 8: curArg:= arg9; |
165 end; |
165 end; |
166 |
166 |
167 // Replace % sign in argument with ASCII ESC |
167 // Replace % sign in argument with ASCII ESC |
168 // to prevent infinite loop below. |
168 // to prevent infinite loop below. |
169 curArg:= StringReplace(curArg, '%', Char($1B), [rfReplaceAll]); |
169 ReplaceChars(curArg, '%', Char($1B)); |
170 |
170 |
171 repeat |
171 repeat |
172 p:= Pos('%'+IntToStr(i+1), tempstr); |
172 p:= Pos('%'+IntToStr(i+1), tempstr); |
173 if (p <> 0) then |
173 if (p <> 0) then |
174 begin |
174 begin |
176 insert(curArg, tempstr, p); |
176 insert(curArg, tempstr, p); |
177 end; |
177 end; |
178 until (p = 0); |
178 until (p = 0); |
179 end; |
179 end; |
180 |
180 |
181 tempstr:= StringReplace(tempstr, Char($1B), '%', [rfReplaceAll]); |
181 ReplaceChars(tempstr, Char($1B), '%'); |
182 Format:= tempstr; |
182 Format:= tempstr; |
183 end; |
183 end; |
184 |
184 |
185 // Same as Format, but for ansistring |
185 // Same as Format, but for ansistring |
186 function FormatA(fmt: ansistring; arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9: ansistring; argCount: Byte): ansistring; |
186 function FormatA(fmt: ansistring; arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9: ansistring; argCount: Byte): ansistring; |
202 8: curArg:= arg9; |
202 8: curArg:= arg9; |
203 end; |
203 end; |
204 |
204 |
205 // Replace % sign in argument with ASCII ESC |
205 // Replace % sign in argument with ASCII ESC |
206 // to prevent infinite loop below. |
206 // to prevent infinite loop below. |
207 curArg:= StringReplace(curArg, '%', Char($1B), [rfReplaceAll]); |
207 ReplaceCharsA(curArg, '%', Char($1B)); |
208 |
208 |
209 repeat |
209 repeat |
210 p:= Pos('%'+IntToStr(i+1), tempstr); |
210 p:= Pos('%'+IntToStr(i+1), tempstr); |
211 if (p <> 0) then |
211 if (p <> 0) then |
212 begin |
212 begin |
214 insert(curArg, tempstr, p); |
214 insert(curArg, tempstr, p); |
215 end; |
215 end; |
216 until (p = 0); |
216 until (p = 0); |
217 end; |
217 end; |
218 |
218 |
219 tempstr:= StringReplace(tempstr, Char($1B), '%', [rfReplaceAll]); |
219 ReplaceCharsA(tempstr, Char($1B), '%'); |
220 FormatA:= tempstr; |
220 FormatA:= tempstr; |
221 end; |
221 end; |
222 |
222 |
223 // The following functions are just shortcuts of Format/FormatA, with fewer argument counts |
223 // The following functions are just shortcuts of Format/FormatA, with fewer argument counts |
224 function Format(fmt: shortstring; arg1: shortstring): shortstring; |
224 function Format(fmt: shortstring; arg1: shortstring): shortstring; |