diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index 8ff51201..111f997e 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -604,8 +604,11 @@ namespace VEPROMS.CSLA.Library { if (!EndsRtfCommand(newvalue, spindx, lstindx)) { - newvalue = newvalue.Remove(spindx, 1); - newvalue = newvalue.Insert(spindx, @"\u160?"); + if (!SpaceBetweenLetters(newvalue, spindx)) // only replace a space with a hard space if the character before or after is a number B2016-144 + { + newvalue = newvalue.Remove(spindx, 1); + newvalue = newvalue.Insert(spindx, @"\u160?"); + } } lstindx = spindx; spindx = (spindx + 1 >= newvalue.Length)?spindx = -1: newvalue.IndexOf(" ", spindx+1); @@ -613,6 +616,18 @@ namespace VEPROMS.CSLA.Library return newvalue; } + private bool SpaceBetweenLetters(string newvalue, int spindx) + { + if (spindx > 0 && spindx < newvalue.Length) + { + char cb = newvalue[spindx - 1]; + char ca = newvalue[spindx + 1]; + if (char.IsLetter(cb) && char.IsLetter(ca)) + return true; + } + return false; + } + private bool EndsRtfCommand(string str, int spindx, int previndx) { // get text from last space to current, or from beginning of string to current: