hedgewars/uUtils.pas
changeset 7191 9419294e5f33
parent 7151 ec15d9e1a7e3
child 7194 d8e68cbca7ee
child 7547 6e9c5feb88eb
equal deleted inserted replaced
7190:aa8d68817c32 7191:9419294e5f33
    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;
    81 {$IFDEF DEBUGFILE}
    82 {$IFDEF DEBUGFILE}
    82 var f: textfile;
    83 var f: textfile;
    83 {$ENDIF}
    84 {$ENDIF}
    84 var CharArray: array[byte] of Char;
    85 var CharArray: array[byte] of Char;
    85 
    86 
       
    87 procedure SplitBySpace(var a,b: shortstring);
       
    88 begin
       
    89 SplitByChar(a,b,' ');
       
    90 end;
       
    91 
    86 // should this include "strtolower()" for the split string?
    92 // should this include "strtolower()" for the split string?
    87 procedure SplitBySpace(var a, b: shortstring);
    93 procedure SplitByChar(var a, b: shortstring; c : char);
    88 var i, t: LongInt;
    94 var i, t: LongInt;
    89 begin
    95 begin
    90 i:= Pos(' ', a);
    96 i:= Pos(c, a);
    91 if i > 0 then
    97 if i > 0 then
    92     begin
    98     begin
    93     for t:= 1 to Pred(i) do
    99     for t:= 1 to Pred(i) do
    94         if (a[t] >= 'A')and(a[t] <= 'Z') then
   100         if (a[t] >= 'A')and(a[t] <= 'Z') then
    95             Inc(a[t], 32);
   101             Inc(a[t], 32);