Code to Determine that the last character was Uppercase

This commit is contained in:
Rich 2010-03-25 19:27:30 +00:00
parent 8dba8a3767
commit b4df2076d3

View File

@ -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<LBInlineShapes, LBInlineShape> /* Collection */
{