kylefoley76
Well-known Member
- Joined
- Mar 1, 2010
- Messages
- 1,553
For those of you who know propositional logic, this is the material implication rule, which takes
(p) -> (q)
and turns it into
~(p) v (q)
I have two problems. In one function I'd like the t in "t as long" to be replaced with the hex character:
21FE
But I won't always be using the hex character so for now I would also like to use the > to stand for the t "t as long". I couldn't get > to work so I just used t.
(p) -> (q)
and turns it into
~(p) v (q)
I have two problems. In one function I'd like the t in "t as long" to be replaced with the hex character:
21FE
But I won't always be using the hex character so for now I would also like to use the > to stand for the t "t as long". I couldn't get > to work so I just used t.
Code:
unction matim(ByVal S As String) As String
Dim X As Long, t As Long, Total As Long
t = InStr(1, S, "t", vbTextCompare)
For X = InStrRev(S, ")", t) To 1 Step -1
If Mid(S, X, 1) = ")" Then
Total = Total + 1
ElseIf Mid(S, X, 1) = "(" Then
Total = Total - 1
End If
If Total = 0 Then
S = Application.Replace(S, X, 0, "~")
Exit For
End If
Next
S = Replace(S, "t", "v", , , vbTextCompare)
matim = S
End Function