Skip to content

Commit f0096f2

Browse files
committed
Added UString.ToString overload. Updated to version 0.9.2.
1 parent 023e8a2 commit f0096f2

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ _ReSharper.Caches/**
55
*.user
66
UnicodeHelper/Resources/UCD/**
77
**/*.snk
8+
.idea/.idea.UnicodeHelper/**

UnicodeHelper/Internal/HelperUtils.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Runtime.CompilerServices;
43

54
namespace UnicodeHelper.Internal
@@ -8,9 +7,6 @@ internal static class HelperUtils
87
{
98
public static TextDirection DetermineDirection(IEnumerable<UCodepoint> codepoints)
109
{
11-
if (codepoints == null)
12-
throw new ArgumentNullException(nameof(codepoints));
13-
1410
bool inIsolate = false;
1511
foreach (UCodepoint uc in codepoints)
1612
{

UnicodeHelper/UString.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,16 @@ public UString Normalize(NormalizationForm form)
723723
return NormalizationEngine.Normalize(this, form);
724724
}
725725

726+
/// <summary>
727+
/// Converts this Unicode string into a standard .Net string from a substring of
728+
/// this Unicode string.
729+
/// The portion starts at a specified character and continues to the end of the string.
730+
/// </summary>
731+
public string ToString(int start)
732+
{
733+
return ToString(start, Length - start);
734+
}
735+
726736
/// <summary>
727737
/// Converts this Unicode string into a standard .Net string from a substring of
728738
/// this Unicode string.

UnicodeHelper/UStringBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,13 @@ public void Dispose()
105105
{
106106
codepointArrayPool.Return(_codepoints);
107107
_codepoints = null;
108+
_length = 0;
108109
GC.SuppressFinalize(this);
109110
}
110111

112+
/// <summary>
113+
/// Finalizes an instance of the <see cref="UStringBuilder"/> class.
114+
/// </summary>
111115
~UStringBuilder()
112116
{
113117
codepointArrayPool.Return(_codepoints);

UnicodeHelper/UnicodeHelper.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<RunAnalyzersDuringLiveAnalysis>False</RunAnalyzersDuringLiveAnalysis>
88
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
99
<Title>Unicode Helper</Title>
10-
<Version>0.9.1</Version>
10+
<Version>0.9.2</Version>
1111
<Authors>FoolRunning</Authors>
1212
<Description>.Net library to get information about Unicode codepoints and to better handle the upper planes (1-16) of Unicode.</Description>
1313
<Copyright>© 2025 Tim Steenwyk</Copyright>
@@ -21,7 +21,7 @@
2121
<DelaySign>False</DelaySign>
2222
<GenerateDocumentationFile>True</GenerateDocumentationFile>
2323
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
24-
<PackageReleaseNotes>Added compatibility normalization to UString.</PackageReleaseNotes>
24+
<PackageReleaseNotes>Added UString.ToString overload.</PackageReleaseNotes>
2525
</PropertyGroup>
2626

2727
<ItemGroup>

0 commit comments

Comments
 (0)