Files
Sourcetrail/ide_plugins/vs/vs2015/SourcetrailPlugin/SourcetrailPlugin/Utility/StringUtility.cs
T
malte_langkabel 7010b9a6fb logic: update Visual Studio plugin to support Visual Studio 2017
* changed description text of Visual Studio plugin
* changed plugin install targets to include VS 2017
* add license file with MIT license
* updated vsix for deployment

* implement wrapper for all used classes of VCProjectEngine.dll since you cannot just use the oldest version of this
  assembly (see https://stackoverflow.com/questions/44288050/typecast-fails-when-visual-studio-extension-uses-reference-to-older-assembly).
* improved serialization and deserialization of compile commands and compilation databases.
* updated used JSON package
* rename CommandObject to CompileCommand
* changed implementation to keep non-existent file paths in cdb
* made methods of SolutionParser non-static
* replace spaces with tabs

* added IntegrationTests project
* configured tests to simulate a new instance of VisualStudio
* added cinder as test project for integration tests
* remove all absolute paths from expected output of integration tests

fortune cookie message = A stranger will bring great meaning to your life.
2017-06-02 14:48:29 +02:00

62 lines
1.1 KiB
C#

using System;
namespace CoatiSoftware.SourcetrailPlugin.Utility
{
public class StringUtility
{
static public Tuple<int, int> FindFirstRange(string text, string startTag, string endTag)
{
if(startTag.Length > 0 && endTag.Length > 0 && (startTag.Length + endTag.Length) < text.Length)
{
int start = text.IndexOf(startTag);
int end = text.IndexOf(endTag);
// just check wheter both, start and end, are valid and the end tag occurs after the start tag
if(start > -1 && end > -1 && end > start)
{
return new Tuple<int, int>(start, end);
}
}
return null;
}
static public int GetMatchingCharsFromStart(string a, string b)
{
int matchingChars = 0;
if (a != string.Empty)
{
a = a.ToLower();
}
else
{
return matchingChars;
}
if (b != string.Empty)
{
b = b.ToLower();
}
else
{
return matchingChars;
}
for (int i = 0; i < Math.Min(a.Length, b.Length); i++)
{
if (!char.Equals(a[i], b[i]))
{
break;
}
else
{
matchingChars++;
}
}
return matchingChars;
}
}
}