diff --git a/src/shared/utils.pas b/src/shared/utils.pas
index f9d8ffafd927c2715bdf5e81907e0a752c4ae020..253e838961316e5bd5e2b19595ba10d7760e033a 100644 (file)
--- a/src/shared/utils.pas
+++ b/src/shared/utils.pas
+(* Copyright (C) DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
{$MODE DELPHI}
unit utils;
function Int64ToStrComma (i: Int64): AnsiString;
function UpCase1251 (ch: Char): Char;
+function LoCase1251 (ch: Char): Char;
// `true` if strings are equal; ignoring case for cp1251
function StrEquCI1251 (const s0, s1: AnsiString): Boolean;
end;
+function LoCase1251 (ch: Char): Char;
+begin
+ if ch < #128 then
+ begin
+ if (ch >= 'A') and (ch <= 'Z') then Inc(ch, 32);
+ end
+ else
+ begin
+ if (ch >= #192) and (ch <= #223) then
+ begin
+ Inc(ch, 32);
+ end
+ else
+ begin
+ case ch of
+ #168, #170, #175: Inc(ch, 16);
+ #161, #178: Inc(ch);
+ end;
+ end;
+ end;
+ result := ch;
+end;
+
+
function StrEquCI1251 (const s0, s1: AnsiString): Boolean;
var
i: Integer;