Files
NetUnicodeInfo/UnicodeInformation/StringExtensions.cs
T
GoldenCrystal 751e84fc6d Add DebuggerDisplay attributes.
Format some code to C# 7.0.
Remove useless using directives.
2017-09-07 23:10:17 +02:00

31 lines
1.4 KiB
C#

namespace System.Unicode
{
/// <summary>Contains extension methods applicable to the <see cref="string"/> type.</summary>
public static class StringExtensions
{
/// <summary>Encapsulates the string in an object which can be used to enumerate code points.</summary>
/// <remarks>
/// The enumerable returned by this method enumerates code points in a strict manner.
/// If the string contains lone surrogates, the enumeration will throw.
/// </remarks>
/// <param name="s">The string to encapsulate.</param>
/// <returns>An enumerable object, which can be used to enumerate code points in the string.</returns>
public static CodePointEnumerable AsCodePointEnumerable(this string s)
{
return new CodePointEnumerable(s);
}
/// <summary>Encapsulates the string in an object which can be used to enumerate code points in a permissive way.</summary>
/// <remarks>
/// The enumerable returned by this method is permissive, regarding the code points represented.
/// It allows invalid sequences, such as lone surrogates, the enumeration will handle those gracefully.
/// </remarks>
/// <param name="s">The string to encapsulate.</param>
/// <returns>An enumerable object, which can be used to enumerate code points in the string.</returns>
public static PermissiveCodePointEnumerable AsPermissiveCodePointEnumerable(this string s)
{
return new PermissiveCodePointEnumerable(s);
}
}
}