mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Style] Change IsUnicode; remove SentenceCase
This commit is contained in:
@@ -351,6 +351,20 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region String Manipulation
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get if a string contains Unicode characters
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="s">Input string to test</param>
|
||||||
|
/// <returns>True if the string contains at least one Unicode character, false otherwise</returns>
|
||||||
|
public static bool IsUnicode(string s)
|
||||||
|
{
|
||||||
|
return (s.Any(c => c > 255));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Externally sourced methods
|
#region Externally sourced methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -407,23 +421,6 @@ namespace SabreTools.Helper
|
|||||||
return readable.ToString("0.### ") + suffix;
|
return readable.ToString("0.### ") + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Converts a string to sentence case.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input">The string to convert.</param>
|
|
||||||
/// <returns>A string representing a sentence case string</returns>
|
|
||||||
/// <remarks>http://stackoverflow.com/questions/3141426/net-method-to-convert-a-string-to-sentence-case</remarks>
|
|
||||||
public static string SentenceCase(string input)
|
|
||||||
{
|
|
||||||
if (input.Length < 1)
|
|
||||||
{
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
string sentence = input.ToLower();
|
|
||||||
return sentence[0].ToString().ToUpper() + sentence.Substring(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// http://stackoverflow.com/questions/311165/how-do-you-convert-byte-array-to-hexadecimal-string-and-vice-versa
|
/// http://stackoverflow.com/questions/311165/how-do-you-convert-byte-array-to-hexadecimal-string-and-vice-versa
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -476,17 +473,6 @@ namespace SabreTools.Helper
|
|||||||
return hexOutput;
|
return hexOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// https://github.com/gjefferyes/RomVault/blob/master/ROMVault2/SupportedFiles/Zip/zipFile.cs
|
|
||||||
/// </summary>
|
|
||||||
public static bool IsUnicode(string s)
|
|
||||||
{
|
|
||||||
char[] c = s.ToCharArray();
|
|
||||||
for (int i = 0; i < c.Length; i++)
|
|
||||||
if (c[i] > 255) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines a text file's encoding by analyzing its byte order mark (BOM).
|
/// Determines a text file's encoding by analyzing its byte order mark (BOM).
|
||||||
/// Defaults to ASCII when detection of the text file's endianness fails.
|
/// Defaults to ASCII when detection of the text file's endianness fails.
|
||||||
|
|||||||
Reference in New Issue
Block a user