diff --git a/UnitTests/Units/StringsTest.pas b/UnitTests/Units/StringsTest.pas
new file mode 100644
index 0000000..cef60dd
--- /dev/null
+++ b/UnitTests/Units/StringsTest.pas
@@ -0,0 +1,37 @@
+unit StringsTest;
+
+interface
+uses
+ TestFramework;
+
+
+type
+ TStringsTest = class(TTestCase)
+ published
+ procedure TestSplit;
+ end;
+
+
+implementation
+uses
+ System.Types,
+
+ X2UtStrings;
+
+
+{ TStringsTest }
+procedure TStringsTest.TestSplit;
+var
+ items: TStringDynArray;
+
+begin
+ Split('value1/value2', '/', items);
+ CheckEquals(2, Length(items), 'Length');
+ CheckEquals('value1', items[0], 'Items[0]');
+ CheckEquals('value2', items[1], 'Items[1]');
+end;
+
+initialization
+ RegisterTest('Strings', TStringsTest.Suite);
+
+end.
diff --git a/UnitTests/X2UtUnitTests.dpr b/UnitTests/X2UtUnitTests.dpr
index 572c1d8..81e715c 100644
--- a/UnitTests/X2UtUnitTests.dpr
+++ b/UnitTests/X2UtUnitTests.dpr
@@ -10,7 +10,8 @@ uses
X2UtSingleInstance in '..\X2UtSingleInstance.pas',
X2UtHashes in '..\X2UtHashes.pas',
X2UtHashesVariants in '..\X2UtHashesVariants.pas',
- NamedFormatTest in 'Units\NamedFormatTest.pas';
+ NamedFormatTest in 'Units\NamedFormatTest.pas',
+ StringsTest in 'Units\StringsTest.pas';
//SettingsTest in 'Units\SettingsTest.pas',
//IniParserTest in 'Units\IniParserTest.pas';
diff --git a/UnitTests/X2UtUnitTests.dproj b/UnitTests/X2UtUnitTests.dproj
index 06f54b1..f394162 100644
--- a/UnitTests/X2UtUnitTests.dproj
+++ b/UnitTests/X2UtUnitTests.dproj
@@ -1,60 +1,152 @@
-
-
- {8bee0e67-704c-4611-9014-0f8cc2fb0289}
- X2UtUnitTests.dpr
- Debug
- AnyCPU
- DCC32
- X2UtUnitTests.exe
-
-
- 7.0
- False
- True
- False
- True
- 0
- True
- True
- ..\
- ..\
- ..\
- ..\
- RELEASE
- False
- False
-
-
- 7.0
- True
- True
- True
- True
- ..\
- ..\
- ..\
- ..\
- DEBUG
- False
- False
-
-
- Delphi.Personality
- VCLApplication
-
-ip-to-country.csv countries.csv geo.dbFalseTrueFalseFalseFalse1000FalseFalseFalseFalseFalse104312521.0.0.01.0.0.0
-
-
-
-
- MainSource
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+ {8bee0e67-704c-4611-9014-0f8cc2fb0289}
+ X2UtUnitTests.dpr
+ Debug
+ DCC32
+ X2UtUnitTests.exe
+ None
+ 13.4
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1043
+
+
+ ip-to-country.csv countries.csv geo.db
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+
+
+ 7.0
+ False
+ True
+ False
+ True
+ 0
+ True
+ True
+ ..\;$(DCC_UnitSearchPath)
+ ..\;$(DCC_ResourcePath)
+ ..\;$(DCC_ObjPath)
+ ..\;$(DCC_IncludePath)
+ RELEASE;$(DCC_Define)
+ False
+ False
+
+
+ 7.0
+ True
+ True
+ True
+ True
+ ..\;$(DCC_UnitSearchPath)
+ ..\;$(DCC_ResourcePath)
+ ..\;$(DCC_ObjPath)
+ ..\;$(DCC_IncludePath)
+ DEBUG;$(DCC_Define)
+ False
+ False
+
+
+ Delphi.Personality.12
+ VCLApplication
+
+
+
+ ip-to-country.csv countries.csv geo.db
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1043
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ X2UtUnitTests.dpr
+
+
+
+ False
+ False
+ True
+
+
+ 12
+
+
+
+
+ MainSource
+
+
+
+
+
+
+
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
diff --git a/X2UtStrings.pas b/X2UtStrings.pas
index 7ed24db..6c7f5fb 100644
--- a/X2UtStrings.pas
+++ b/X2UtStrings.pas
@@ -295,7 +295,7 @@ begin
end;
// Copy substring
- iSize := Integer(pPos) - Integer(pLast);
+ iSize := (Integer(pPos) - Integer(pLast)) div SizeOf(Char);
SetString(ADest[iCount - 1], pLast, iSize);
// Move pointer