String Comparison


Author
Message
Ben Kim
Ben Kim
StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Thanks Greg.  This should work out find with the exception of reverse searching which I do not believe we used anyway in the legacy code.

Ben

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Ben,



Check out String.IndexOf. I.e. "abcdef".IndexOf("def") = 3



Ben Kim
Ben Kim
StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Hello all,

The language we are converting from had a handle function we could call that would do string comparisons.  For example:

If InString("DEF", "ABCDEFXYZ", 1, 1)
   ...Do something - return value was 3 (found at character position 3)
Else
   ...Comparison failed
End

Params for INSTRING(SubString, String, (optional Step), (optional Start))
SubString - A string constant, variable or expression that contains the string for which to search

String - A string constant or variable to be searched

Step - An optional numeric constant, variable or expression which specifies the step length of the search.  A step of 1 would search for the substring at every character in string, 2 starts at every other character. A negative step value of -1 will search from right to left within the string.  If omitted, step is defaulted to the length of the substring

Start - An optional numeric constant, variable or expression which specifies where to begin the search of the string.  If omitted it is defaulted to 1.

I have looked at the String Comparison method of the String type and it does not seem to fit the bill.  Before coding this function myself, does anyone know of any other built-in methods that would work just like the Clarion InString function? Or offer a code snippet?

Thanks!

Ben

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search