hedgewars/uFLUtils.pas
author unc0rr
Wed, 19 Nov 2014 00:38:14 +0300
branchqmlfrontend
changeset 10517 844bd43db47a
parent 10440 b74a7bbe224e
child 10616 20a2d5e6930a
permissions -rw-r--r--
getScriptsList implementation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     1
unit uFLUtils;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     2
interface
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     3
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     4
function str2PChar(const s: shortstring): PChar;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     5
function intToStr(n: LongInt): shortstring;
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
     6
function midStr(s: shortstring; pos: byte): shortstring;
10517
844bd43db47a getScriptsList implementation
unc0rr
parents: 10440
diff changeset
     7
procedure underScore2Space(var s: shortstring);
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     8
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     9
implementation
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    10
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    11
var
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    12
    str2PCharBuffer: array[0..255] of char;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    13
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    14
function str2PChar(const s: shortstring): PChar;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    15
var i: Integer;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    16
begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    17
   for i:= 1 to Length(s) do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    18
      begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    19
      str2PCharBuffer[i - 1] := s[i];
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    20
      end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    21
   str2PCharBuffer[Length(s)]:= #0;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    22
   str2PChar:= @(str2PCharBuffer[0]);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    23
end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    24
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    25
function intToStr(n: LongInt): shortstring;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    26
begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    27
    str(n, intToStr)
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    28
end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    29
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    30
function midStr(s: shortstring; pos: byte): shortstring;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    31
begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    32
    midStr:= copy(s, pos, length(s) - pos + 1)
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    33
end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    34
10517
844bd43db47a getScriptsList implementation
unc0rr
parents: 10440
diff changeset
    35
procedure underScore2Space(var s: shortstring);
844bd43db47a getScriptsList implementation
unc0rr
parents: 10440
diff changeset
    36
var i: LongInt;
844bd43db47a getScriptsList implementation
unc0rr
parents: 10440
diff changeset
    37
begin
844bd43db47a getScriptsList implementation
unc0rr
parents: 10440
diff changeset
    38
    for i:= length(s) downto 1 do
844bd43db47a getScriptsList implementation
unc0rr
parents: 10440
diff changeset
    39
        if s[i] = '_' then s[i]:= ' '
844bd43db47a getScriptsList implementation
unc0rr
parents: 10440
diff changeset
    40
end;
844bd43db47a getScriptsList implementation
unc0rr
parents: 10440
diff changeset
    41
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    42
end.