vbscript 检测数字和单位之间是否有空格;单位是否缩写

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript 检测数字和单位之间是否有空格;单位是否缩写相关的知识,希望对你有一定的参考价值。

Sub detectUnit()
arr = " millimeters , millimeter , centimeters , centimeter , meters , meter , kilometers , kilometer , grams , gram , kilograms , kilogram , liters , liter , minutes , minute , seconds , second , hours , hour , mins  , gr , hr , sec "
brr = "millimeters ,millimeter ,centimeters ,centimeter ,meters ,meter ,kilometers ,kilometer ,grams ,gram ,kilograms ,kilogram ,liters ,liter ,minutes ,minute ,seconds ,second ,hours ,hour ,mins ,gr ,hr ,sec ,mm ,mm ,cm ,cm ,m ,m ,km ,km ,g ,g ,kg ,kg ,L ,L ,min ,min ,s ,s ,h ,h ,min ,g ,h ,s "
full = Split(arr, ","): abbr = Split(brr, ",")
For i = 0 To UBound(abbr)
    With Selection.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        
        .MatchCase = True
        .MatchWildcards = True
        .Wrap = wdFindContinue
        .Text = "[0-9]" + abbr(i)
        Do
        DoEvents
        .Execute
        
        If .Found Then
           
                Selection.Range.HighlightColorIndex = wdRed
           
        Else
            Exit Do
        End If
        Loop
    End With
    
Next

For i = 0 To UBound(full)
With Selection.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        
        .MatchCase = True
        .MatchWildcards = False
        .Wrap = wdFindContinue
        .Text = full(i)
        Do
        .Execute
        
        If .Found Then
            If IsNumeric(Selection.Range.Previous(wdCharacter, 1)) Then
                Selection.Range.HighlightColorIndex = wdRed
            End If
        Else
        Exit Do
        End If
        Loop
    End With
Next
End Sub

以上是关于vbscript 检测数字和单位之间是否有空格;单位是否缩写的主要内容,如果未能解决你的问题,请参考以下文章

SQL标准是不是允许函数名和括号之间有空格

java 解析xml时标签之间有空格

字母验证码有空格怎样写

bash变量

web常用测试点记录

编写一个shell脚本程序,实现100的阶乘并输出