From b4df2076d360c7709a124b54e3706f92c29c027b Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 25 Mar 2010 19:27:30 +0000 Subject: [PATCH] Code to Determine that the last character was Uppercase --- PROMS/LBWordLibrary/LBObjectExtension.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/PROMS/LBWordLibrary/LBObjectExtension.cs b/PROMS/LBWordLibrary/LBObjectExtension.cs index a03b27c1..1595f77c 100644 --- a/PROMS/LBWordLibrary/LBObjectExtension.cs +++ b/PROMS/LBWordLibrary/LBObjectExtension.cs @@ -4,6 +4,7 @@ using System.Text; using System.Reflection; using Microsoft.Win32; using System.Windows.Forms; +using System.Text.RegularExpressions; namespace LBWordLibrary { @@ -93,8 +94,6 @@ namespace LBWordLibrary if (!proc.HasExited) KillAndWait(proc); } - - private static void KillAndWait(System.Diagnostics.Process proc) { Console.WriteLine("{0:s.ffff} Killing Adobe", DateTime.Now); @@ -325,6 +324,23 @@ namespace LBWordLibrary { return InvokeMethod("EndKey", Unit, Extend) as int? ?? 0; } + public bool LastWasUpper + { + get + { + LBRange myRange = Range; + int start = myRange.Start - 1; + while (start >= 0) + { + myRange.Start = start; + myRange.End = start + 1; + if (Regex.IsMatch(myRange.Text, "[A-Z]")) return true; + if (Regex.IsMatch(myRange.Text, "[a-z]")) return false; + start = start - 1; + } + return false; + } + } } public partial class LBInlineShapes : LBComObjectList /* Collection */ {