hedgewars/uUtils.pas
changeset 15991 4ad8dd66d9d5
parent 15897 d7b53d08ad9c
child 15998 91c487e7d11d
equal deleted inserted replaced
15990:79b1129b4d03 15991:4ad8dd66d9d5
    32 procedure SplitByCharA(var a, b: ansistring; c: char);
    32 procedure SplitByCharA(var a, b: ansistring; c: char);
    33 
    33 
    34 procedure EscapeCharA(var a: ansistring; e: char);
    34 procedure EscapeCharA(var a: ansistring; e: char);
    35 procedure UnEscapeCharA(var a: ansistring; e: char);
    35 procedure UnEscapeCharA(var a: ansistring; e: char);
    36 
    36 
       
    37 procedure ReplaceChars(var a: shortstring; c1, c2: char);
       
    38 procedure ReplaceCharsA(var a: ansistring; c1, c2: char);
       
    39 
    37 function ExtractFileDir(s: shortstring) : shortstring;
    40 function ExtractFileDir(s: shortstring) : shortstring;
    38 function ExtractFileName(s: shortstring) : shortstring;
    41 function ExtractFileName(s: shortstring) : shortstring;
    39 
    42 
    40 function  EnumToStr(const en : TGearType) : shortstring; overload;
    43 function  EnumToStr(const en : TGearType) : shortstring; overload;
    41 function  EnumToStr(const en : TVisualGearType) : shortstring; overload;
    44 function  EnumToStr(const en : TVisualGearType) : shortstring; overload;
   301         end
   304         end
   302     else
   305     else
   303         break;
   306         break;
   304 until (i <= 0);
   307 until (i <= 0);
   305 end; { UnEscapeCharA }
   308 end; { UnEscapeCharA }
       
   309 
       
   310 // Replace all characters c1 with c2 in shortstring a
       
   311 procedure ReplaceChars(var a: shortstring; c1, c2: char);
       
   312 var i: LongInt;
       
   313 begin
       
   314 repeat
       
   315     i:= Pos(c1, a);
       
   316     if (i > 0) then
       
   317         a[i]:= c2;
       
   318 until (i <= 0);
       
   319 end; { ReplaceChars }
       
   320 
       
   321 // Replace all characters c1 with c2 in antistring a
       
   322 procedure ReplaceCharsA(var a: ansistring; c1, c2: char);
       
   323 var i: LongInt;
       
   324 begin
       
   325 repeat
       
   326     i:= Pos(c1, a);
       
   327     if (i > 0) then
       
   328         a[i]:= c2;
       
   329 until (i <= 0);
       
   330 end; { ReplaceCharsA }
   306 
   331 
   307 function EnumToStr(const en : TGearType) : shortstring; overload;
   332 function EnumToStr(const en : TGearType) : shortstring; overload;
   308 begin
   333 begin
   309 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en))
   334 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en))
   310 end;
   335 end;