hedgewars/uUtils.pas
changeset 7194 d8e68cbca7ee
parent 7180 53ffc8853008
parent 7191 9419294e5f33
child 7198 5debd5fe526e
equal deleted inserted replaced
7180:53ffc8853008 7194:d8e68cbca7ee
    22 
    22 
    23 interface
    23 interface
    24 uses uTypes, uFloat, GLunit;
    24 uses uTypes, uFloat, GLunit;
    25 
    25 
    26 procedure SplitBySpace(var a, b: shortstring);
    26 procedure SplitBySpace(var a, b: shortstring);
       
    27 procedure SplitByChar(var a, b: shortstring; c: char);
    27 procedure SplitByChar(var a, b: ansistring; c: char);
    28 procedure SplitByChar(var a, b: ansistring; c: char);
    28 
    29 
    29 {$IFNDEF PAS2C}
    30 {$IFNDEF PAS2C}
    30 function  EnumToStr(const en : TGearType) : shortstring; overload;
    31 function  EnumToStr(const en : TGearType) : shortstring; overload;
    31 function  EnumToStr(const en : TVisualGearType) : shortstring; overload;
    32 function  EnumToStr(const en : TVisualGearType) : shortstring; overload;
    83 var f: textfile;
    84 var f: textfile;
    84     logMutex: TRTLCriticalSection; // mutex for debug file
    85     logMutex: TRTLCriticalSection; // mutex for debug file
    85 {$ENDIF}
    86 {$ENDIF}
    86 var CharArray: array[byte] of Char;
    87 var CharArray: array[byte] of Char;
    87 
    88 
       
    89 procedure SplitBySpace(var a,b: shortstring);
       
    90 begin
       
    91 SplitByChar(a,b,' ');
       
    92 end;
       
    93 
    88 // should this include "strtolower()" for the split string?
    94 // should this include "strtolower()" for the split string?
    89 procedure SplitBySpace(var a, b: shortstring);
    95 procedure SplitByChar(var a, b: shortstring; c : char);
    90 var i, t: LongInt;
    96 var i, t: LongInt;
    91 begin
    97 begin
    92 i:= Pos(' ', a);
    98 i:= Pos(c, a);
    93 if i > 0 then
    99 if i > 0 then
    94     begin
   100     begin
    95     for t:= 1 to Pred(i) do
   101     for t:= 1 to Pred(i) do
    96         if (a[t] >= 'A')and(a[t] <= 'Z') then
   102         if (a[t] >= 'A')and(a[t] <= 'Z') then
    97             Inc(a[t], 32);
   103             Inc(a[t], 32);