I'd like to use the like operator in vb.net to find numbers. I have written a function which is given formulas to analyse. It needs to return TRUE
if the formula contains numbers. Given that numbers also exist in worksheet names, functions, and cell references it is tricky.
I have got the function almost finished however I need one last bit of code.
Using the like operator I want to write a statement that will look for constants in the string and the constant will also be proceeded with a space " "
and followed by a space " "
.
For example I want the like statement to return true on the following:
if " 'Essbase P&L'!$A:$BG,H$5 CBS_Act13 12345 " like "* [0-9] *" then
' Do Action Here
The number 12345
or other constants will always have a space directly before AND after.
Any ideas?
You Can:
Using Regex:
Dim Str = " 'Essbase P&L'!$A:$BG,H$5 CBS_Act13 12345 " If Regex.IsMatch (Str, " (\\d*) ") Then
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.