From eed402ef7fd29eb28079c8f8ed9e28752aaf496d Mon Sep 17 00:00:00 2001 From: John Date: Wed, 12 Oct 2011 12:43:51 +0000 Subject: [PATCH] added unicode dash to regular expression check for Fortran format numbers --- PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs index a2269ee4..847d12c5 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs @@ -929,8 +929,14 @@ namespace VEPROMS.CSLA.Library #region FortranFormat public static string ConvertFortranFormatToScienctificNotation(string str) { - str = str.Replace(@"\u8209?", "-"); - string retval = Regex.Replace(str, "([+-]?)([0-9]+)[.]([0-9]*?)0*E([+-]?[0-9]+)", new MatchEvaluator(FixFortranNumber)); + // ([+-]?|\\u8209\?) either an optional single character Plus (+) or Minus (-) or non-breaking dash (\u8209?) + // ([0-9]+) a group of at least one digits + // [.] a decimal point + // ([0-9]*?) a group of zero or more digits + // 0*E optional zeros (spare zeros) followed + // ([+-]?|\\u8209\?) either an optional single character Plus (+) or Minus (-) or non-breaking dash (\u8209?) + // ([0-9]+) a group of at least one digits + string retval = Regex.Replace(str, @"([+-]?|\\u8209\?)([0-9]+)[.]([0-9]*?)0*E([+-]?|\\u8209\?)([0-9]+)", new MatchEvaluator(FixFortranNumber)); retval = Regex.Replace(retval, "[#](.*?)[#]", "\\up2 $1\\up0 ");// DOS Superscript retval = Regex.Replace(retval, "[~](.*?)[~]", "\\dn2 $1\\up0 ");// DOS Subscript return retval; @@ -946,7 +952,7 @@ namespace VEPROMS.CSLA.Library else // A number with a decimal point sb.Append(match.Groups[2].Value + "." + match.Groups[3].Value + "x10"); // Add the exponent as superscript - return sb.ToString() + "\\up2 " + match.Groups[4].Value.Replace("-",@"\u8209?") + "\\up0 "; + return sb.ToString() + "\\up2 " + match.Groups[4].Value.Replace("-",@"\u8209?") + match.Groups[5].Value + "\\up0 "; } #endregion }