From 9c50cfa7892a194e0e6fd8ba04844e2b307a36f9 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Fri, 8 Jul 2016 02:34:30 +0200 Subject: [PATCH] add string helper to convert to int --- src/ce_common.pas | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ce_common.pas b/src/ce_common.pas index fe0995c6..51f5463c 100644 --- a/src/ce_common.pas +++ b/src/ce_common.pas @@ -80,6 +80,8 @@ type function dirExists: boolean; function upperCase: string; function length: integer; + function toIntNoExcept(default: integer = -1): integer; + function toInt: integer; end; (** @@ -430,6 +432,16 @@ begin exit(system.length(self)); end; +function TStringHelper.toInt: integer; +begin + exit(strToInt(self)); +end; + +function TStringHelper.toIntNoExcept(default: integer = -1): integer; +begin + exit(StrToIntDef(self, default)); +end; + procedure TProcessEx.Assign(aValue: TPersistent); var src: TProcess;