ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   String Functions (https://www.excelbanter.com/excel-programming/413767-string-functions.html)

John

String Functions
 
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

Mike H

String Functions
 
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

"John" wrote:

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


Rick Rothstein \(MVP - VB\)[_2269_]

String Functions
 
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


"John" wrote in message
...
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




All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com