Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
日本語パスを判定したい時に使う
using System.Text.RegularExpressions;
using System;
public class PathChecker{
static bool IsContainHiragana(string str)
{
return Regex.IsMatch(str, @"[\p{IsHiragana}]");
}
static bool IsContainKatakana(string str)
{
return Regex.IsMatch(str, @"[\p{IsKatakana}]");
}
static bool IsContainKanji(string str)
{
return Regex.IsMatch(str, @"[\p{IsCJKUnifiedIdeographs}" +
@"\p{IsCJKCompatibilityIdeographs}" +
@"\p{IsCJKUnifiedIdeographsExtensionA}]|" +
@"[\uD840-\uD869][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF]");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.