From 13105d704876c46e537e5decb8fe708eac606570 Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 27 Jan 2022 13:58:43 +0000 Subject: [PATCH] B2022-022: BNPP replace words, NotInRO flag not always working when other replacements exist in step --- PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index b9ad0099..7f14cec6 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -2538,15 +2538,17 @@ namespace VEPROMS.CSLA.Library return text; } // B2022-015 BNPPalr: Determine whether RO text should have Replace Words applied + // B2022-022 BNPP needed to add use of 'offset' to work with string. 'offset' is used in code to keep track + // of offset in text in case other replacements are made before the current, i.e. adjusts the index found in the Match. private bool VerifyWithinLink(string text, FoundMatch foundMatch, int offset) { // Is Match within a link, i.e. between a start & end and has '#Link:R' (defined referenced object link) between them too - int sindx = text.LastIndexOf(" -1) { int eindx = text.IndexOf("[END>",sindx + 1); bool isRo = eindx > sindx && text.Substring(sindx, eindx - sindx - 1).Contains("#Link:R"); - if (isRo && foundMatch.MyMatch.Index > sindx && foundMatch.MyMatch.Index < eindx) return true; + if (isRo && foundMatch.MyMatch.Index + offset > sindx && foundMatch.MyMatch.Index + offset < eindx) return true; // B2022-022 added offset } return false; }