M2P11 找 S 字串中的阿拉伯數字
Function M2P11(ByVal S As String) As String
M2P11
= ""
For i = 1 To s.Length
Dim c As Char = Mid(s, i, 1)
If c >= "0" And c
<= "9" Then M2P11 &= c
Next
If M2P11
= "" Then Return "N"
End Function
變化1 M2P11 找 S 字串中奇數的阿拉伯數字
Function M2P11(ByVal S As String) As String
M2P11
= ""
For i = 1 To s.Length
Dim c As Char = Mid(s, i, 1)
If c >= "0" And c
<= "9" And Val(c) Mod 2 = 1 Then M2P11 &= c
Next
If M2P11
= "" Then Return "N"
End Function
變化2 M2P11 找 S 字串中0~7的阿拉伯數字
Function M2P11(ByVal S As String) As String
M2P11 = ""
For i = 1 To s.Length
Dim c As Char = Mid(s, i, 1)
If c >= "0" And c <= "7" Then M2P11 &= c
Next
If M2P11 = "" Then Return "N"
End Function
變化3 M2P11 找 S 字串中0~9加A~F的數字(十六進位)
Function M2P11(ByVal S As String) As String
M2P11 = ""
For i = 1 To s.Length
Dim c As Char = Mid(s, i, 1)
If c >= "0" And c <= "9" Or c >= "A" And c <= "F" Then M2P11 &= c
Next
If M2P11 = "" Then Return "N"
End Function
0 意見:
張貼留言