我想知道我可以使用哪种正则表达式模式来检测字符串中的每个字符是否都是数字。
所以,这就是我想的不起作用的地方:
sub voodoo()
Dim theresult As Variant
With Sheets("Sheet9") 'Change to your sheet
If Application.WorksheetFunction.CountA(.Cells) <> 0 Then
Set theresult = .Range("Y:DD").Find(What:="*", _
After:=.Range("Y1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)
Else
'Used 1000 to prove that it was not defaulting to this.
'Change to 1 when using in actual code.
lastrow = 1000 'Change to 1 when using.
End If
MsgBox ("LastRow " & theresult.Row & " column " & theresult.Column)
End With
End Sub
该语句为stringr::str_detect("311apple", "[0-9]")
#> [1] TRUE
,因为该字符串中存在一个数字字符,但是我试图找到一个模式,以便如果每个字符为TRUE
数字。
有什么想法吗?谢谢!