Lasso Soft Inc. > Home

[String->Compare]

[String->Compare] compares the base string to the first parameter and returns 0 if they are equal, 1 if the characters in the string are bitwise greater than the parameter, and -1 if the characters in the string are bitwise less than the parameter. Comparisons are made case insensitive by default. An optional -Case parameter compares the string taking case into account.

A second form of the tag compares the base string to a portion of a parameter string. The first parameter is an offset into the comparison string. The second parameter is the length of characters in the comparison string to be taken into account. And, the third parameter is the comparison string.

Additional optional fourth and fifth parameter specify and offset and length into the base string. This allows a portion of the base string to be compared to a portion of the comparison string.

  • Syntax
  • Parameters
[If: 'Base String'->(Compare: 'Param String')] ... [/If]

[If: 'Base String'->(Compare: 'Param String', -Case)] ... [/If]

<?LassoScript
If: 'Base String'->(Compare: 7, 6, 'Param String'); 
... 
/If;
?gt;

<?LassoScript
If: 'Base String'->(Compare: 7, 6, 'Param String', 6, 6); 
... 
/If;
?gt;
Required Parameters
Base String The string which is to be compared.
Comparison String The comparison string. This is the only required parameter.
Optional Parameters
Offset An offset into the comparison string.
Length The number of characters in the comparison string which should be taken into account.
Offset An offset into the base string.
Length The number of characters in the base string which should be taken into account.
Examples

To compare two strings:

Use the [String->Compare] tag. The following example compares the base string to the first paramter of [String->Compare]. 1 is returned because the parameter is contained within the base string.

[var:'x'='Quick fox']
[$x->(Compare: 'Quick')]
Result:
1
Tag Link [String->Compare] Category String
Type Member Data Source Any
Support Preferred Version 7.0
Output Type Boolean Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft