System.Globalization.CompareInfo.IsPrefix C# (CSharp) Méthode

IsPrefix() public méthode

public IsPrefix ( String source, String prefix ) : bool
source String
prefix String
Résultat bool
        public virtual bool IsPrefix(String source, String prefix)
        {
            return (IsPrefix(source, prefix, 0));
        }
    

Same methods

CompareInfo::IsPrefix ( String source, String prefix, CompareOptions options ) : bool

Usage Example

Exemple #1
0
    private static string GetRelativePath(string fullPath)
    {
        string currentDir = Directory.GetCurrentDirectory();

        if (currentDir == null || currentDir.Length == 0)
        {
            return(fullPath);
        }
        System.Globalization.CompareInfo compInfo = System.Globalization.CultureInfo.InvariantCulture.CompareInfo;
        if (compInfo.IsPrefix(fullPath, currentDir, System.Globalization.CompareOptions.IgnoreCase))
        {
            return(fullPath.Substring(currentDir.Length + 1));
        }
        return(fullPath);
    }
All Usage Examples Of System.Globalization.CompareInfo::IsPrefix