String Functions

  • Thread starter Thread starter John
  • Start date Start date
J

John

Which Operator do i use to compare text. eg if i want to use an "IF"
statement. To test for string that will reflect text written in any order
 
John,

I think we need a bit more detail to address this. What does this mean?

To test for string that will reflect text written in any order

Mike
 
Not sure what you mean by this. Are you asking if the two text strings being
compared are composed of the same characters, just possibly in a different
ordering? If so, there is no operator in VB that does what you want
directly. Give this function a try...

Function IsIdenticalCharacters(Text1 As String, Text2 As String) As Boolean
Dim X As Long
Dim Position As Long
Dim TempText As String
TempText = Text1
For X = 1 To Len(Text2)
Position = InStr(TempText, Mid(Text2, X, 1))
If Position > 0 Then Mid(TempText, Position, 1) = Chr$(1)
Next
IsIdenticalCharacters = TempText = String(Len(TempText), Chr$(1))
End Function

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top