From c41bfec28cdb530580eebb6262da879d8b165297 Mon Sep 17 00:00:00 2001 From: wistfullly <115614421+wistfullly@users.noreply.github.com> Date: Sat, 1 Jun 2024 15:37:20 +0300 Subject: [PATCH 1/2] Update cstring.h --- cstring.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cstring.h b/cstring.h index f99bd4c..c170ce8 100644 --- a/cstring.h +++ b/cstring.h @@ -941,4 +941,28 @@ double stringToDouble(TString s) { return number + decimal; } +int64_t stringToInt(TString s) { + int64_t result = 0; + int sign = 1; + size_t i = 0; + + while (i < s.size && s.data[i] == ' ') { + i++; + } + + if (i < s.size && s.data[i] == '-') { + sign = -1; + i++; + } else if (i < s.size && s.data[i] == '+') { + i++; + } + + while (i < s.size && s.data[i] >= '0' && s.data[i] <= '9') { + result = result * 10 + (s.data[i] - '0'); + i++; + } + + return result * sign; +} + #endif From 61fe167bc5e6682b56e0ce12ec93ad5d38f70ce7 Mon Sep 17 00:00:00 2001 From: wistfullly <115614421+wistfullly@users.noreply.github.com> Date: Sat, 1 Jun 2024 15:38:28 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D0=B8=20=D0=B2=20=D1=87=D0=B8=D1=81=D0=BB?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit