IsPrefix() public method

public IsPrefix ( String source, String prefix ) : bool
source String
prefix String
return bool
コード例 #1
0
ファイル: main.cs プロジェクト: Plankankul/SpecSharp
    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);
    }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: mhusinsky/prepose
        private IList<ICompletionData> CheckAndAddCompletion(CompareInfo comparer, string word, IList<ICompletionData> data, string option)
        {
            if (comparer.IsPrefix(option, word))
            {
                if (data == null)
                {
                    completionWindow = new CompletionWindow(this.ScriptTextBox.TextArea);
                    completionWindow.CompletionList.InsertionRequested += CompletionList_InsertionRequested;
                    data = completionWindow.CompletionList.CompletionData;
                }

                data.Add(new PreposeSyntaxCompletionData(option));
            }

            return data;
        }