B2022-007 added while loop to process more than on <U-xxx> value

This commit is contained in:
John Jenko 2022-01-11 16:18:25 +00:00
parent 2b32b245a4
commit 7a68643837

View File

@ -2332,13 +2332,15 @@ i = 0;
// F2021-034: Resolve applicability unit tokens (not just '<u>')
private string ResolveUnitApp(DocVersionInfo dvi, string str)
{
if (dvi == null) return str;
string tmp = str.ToUpper();
int sindx = tmp.IndexOf("<U");
int eindx = tmp.IndexOf(">", sindx + 1);
string reptmp = str.Substring(sindx, eindx - sindx+1);
tmp = reptmp.ToUpper();
if (reptmp != "" && dvi != null)
string reptmp;
while (sindx > -1 && eindx > -1) // B2022-007 added while loop to process more than one <U- RO value
{
reptmp = str.Substring(sindx, eindx - sindx + 1);
tmp = reptmp.ToUpper();
if (tmp == "<U>") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number);
else if (tmp == "<U-TEXT>") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Text);
else if (tmp == "<U-NUMBER>") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number);
@ -2349,6 +2351,10 @@ i = 0;
else if (tmp == "<U-OTHERNUMBER>") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Number);
else if (tmp == "<U-OTHERNAME>") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Name);
else if (tmp == "<U-OTHERID>") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_ID);
else str = str.Replace(reptmp, tmp.Replace("<", "*?").Replace(">", "?*"));
tmp = str.ToUpper();
sindx = tmp.IndexOf("<U");
eindx = tmp.IndexOf(">", sindx + 1);
}
return str;
}