using System.Linq;
namespace Convai.Scripts.Runtime.Utils
{
///
/// Utility for language features
///
public abstract class ConvaiLanguageCheck
{
private const char MIN_ARABIC_RANGE = '\u0600';
private const char MAX_ARABIC_RANGE = '\u06FF';
///
/// To check if the text is in a Right-to-Left(RTL) Language
///
/// The text for RTL Check.
/// Bool denoting the text is RTL or not
public static bool IsRTL(string text)
{
return text.Any(c => c is >= MIN_ARABIC_RANGE and <= MAX_ARABIC_RANGE);
}
}
}