Get Current Directory for your Application C# , C Sharp

No Comments

 

You can call this function to Current Directory for your running Application

 

public static string GetAppPath()
{
    string ExePath = System.Windows.Forms.Application.ExecutablePath;
    if (Path.GetDirectoryName(ExePath).EndsWith("\\"))
    {
        return Path.GetDirectoryName(ExePath);
    }
    else
    {
        return Path.GetDirectoryName(ExePath) + "\\";
    }
}

Detected if string Non English language C#

2 Comments

 

This class will help you to detect if the string contains non English characters ,

The System.Text.RegularExpressions namespace contains classes that provide access to the .NET Framework regular expression engine. ( Regex )

 

public bool IsEnglish(string inputstring)
{
    Regex regex = new Regex(@"[A-Za-z0-9 .,-=+(){}\[\]\\]");
    MatchCollection matches = regex.Matches(inputstring);

    if (matches.Count.Equals(inputstring.Length))
        return true;
    else
        return false;
}

Enjoy …