B2026 053 find unlinked values of selected #795
@@ -2199,7 +2199,7 @@ namespace Volian.Controls.Library
|
||||
if (match.Success) // Special case for percents.
|
||||
{
|
||||
int sl = SearchString.Length;
|
||||
int precentIdx = SearchString.IndexOf('%');
|
||||
int precentIdx = SearchString.LastIndexOf('%');
|
||||
|
mschill marked this conversation as resolved
Outdated
|
||||
int startIndex = 0;
|
||||
if (sl == precentIdx + 1) // % the last char.
|
||||
{
|
||||
@@ -2207,12 +2207,26 @@ namespace Volian.Controls.Library
|
||||
var isNumeric = int.TryParse(ss, out int n);
|
||||
if (isNumeric == true) // B2026-053 other that a % are the rest of the characters numbers.
|
||||
|
mschill marked this conversation as resolved
Outdated
mschill
commented
With working on tech debt project --- moving forward need to follow suggested code practices / suggestions by SonarLint --- if (isNumeric == true) should be With working on tech debt project --- moving forward need to follow suggested code practices / suggestions by SonarLint --- if (isNumeric == true) should be
if (isNumeric)
|
||||
{
|
||||
ss = ' ' + SearchString; //B2026-053 add a space prefix to make the search exact. If search is 5% this makes it excult 25% 55% etc.;
|
||||
ss = ' ' + SearchString + ' '; // to get exact match add spaces before and after search string.
|
||||
|
mschill marked this conversation as resolved
Outdated
mschill
commented
With working on technical debt - should avoid concatenating strings & use string interpolation instead. With working on technical debt - should avoid concatenating strings & use string interpolation instead.
|
||||
}
|
||||
else
|
||||
{
|
||||
ss = ' ' + SearchString + ' '; // string it not a percent.
|
||||
|
mschill marked this conversation as resolved
Outdated
mschill
commented
With working on technical debt - should avoid concatenating strings & use string interpolation instead. With working on technical debt - should avoid concatenating strings & use string interpolation instead.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ss = ' ' + SearchString + ' '; // Exact match add spaces before and after search string.
|
||||
int strl2 = SearchString.Length;
|
||||
int prcIdx2 = SearchString.LastIndexOf(' ');
|
||||
int strIdx2 = 0;
|
||||
if (strl2 == prcIdx2 + 1) // if the last char is ' ' the last char.
|
||||
{
|
||||
ss = ' ' + SearchString; //B2026-053 add a space prefix to make the search exact. If search is 5% this makes it excult 25% 55% etc.;
|
||||
|
mschill marked this conversation as resolved
Outdated
mschill
commented
With working on technical debt - should avoid concatenating strings & use string interpolation instead. With working on technical debt - should avoid concatenating strings & use string interpolation instead.
|
||||
}
|
||||
else
|
||||
{
|
||||
ss = ' ' + SearchString + ' '; // Exact match add spaces before and after search string.
|
||||
|
mschill marked this conversation as resolved
Outdated
mschill
commented
With working on technical debt - should avoid concatenating strings & use string interpolation instead. With working on technical debt - should avoid concatenating strings & use string interpolation instead.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user
What if multiple % signs? - like search for:
3% or 4% --- I believe the matches returned by the Regex object will give position of what is found.