55 lines
2.0 KiB
C#
55 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace KssSmaPlaLib.Commons.Conversion
|
|
{
|
|
public static class KanaConvertUxer
|
|
{
|
|
/// <summary>
|
|
/// 半角カタカナを全角カタカナに変換します。
|
|
/// 空文字やnullはそのまま返却します。
|
|
/// </summary>
|
|
// public static bool TryConvertHankakuToZenkaku(string input, out string result, out string resultMessage)
|
|
// {
|
|
// result = input;
|
|
// resultMessage = string.Empty;
|
|
|
|
// if (string.IsNullOrEmpty(input))
|
|
// return true;
|
|
|
|
// // 半角カタカナが含まれているかチェック
|
|
// if (!Regex.IsMatch(input, @"[\uFF61-\uFF9F]"))
|
|
// return true;
|
|
|
|
// // 変換処理
|
|
// result = Microsoft.VisualBasic.Strings.StrConv(input, Microsoft.VisualBasic.VbStrConv.Katakana | Microsoft.VisualBasic.VbStrConv.Wide, 0);
|
|
// return true;
|
|
// }
|
|
|
|
/// <summary>
|
|
/// 全角カタカナを半角カタカナに変換します。
|
|
/// 空文字やnullはそのまま返却します。
|
|
/// </summary>
|
|
// public static bool TryConvertZenkakuToHankaku(string input, out string result, out string resultMessage)
|
|
// {
|
|
// result = input;
|
|
// resultMessage = string.Empty;
|
|
|
|
// if (string.IsNullOrEmpty(input))
|
|
// return true;
|
|
|
|
// // 全角カタカナが含まれているかチェック(ざっくり)
|
|
// if (!Regex.IsMatch(input, @"[\u30A0-\u30FF]"))
|
|
// return true;
|
|
|
|
// // 変換処理
|
|
// result = Microsoft.VisualBasic.Strings.StrConv(input, Microsoft.VisualBasic.VbStrConv.Katakana | Microsoft.VisualBasic.VbStrConv.Narrow, 0);
|
|
// return true;
|
|
// }
|
|
}
|
|
}
|