Lasso Soft Inc. > Home

[C_Compare]

LinkC_Compare
AuthorGöran Törnquist
CategoryComparator
Version8.x
LicensePublic Domain
Posted22 Oct 2007
Updated22 Oct 2007
More by this author...

Description

Replacement of the built-in comparators that works with all types of arrays. These avoids a runtime exception when keywords are used in the arrays.

Sample Usage

local('array1'=array(-database='work', -op='gt', 'few', 'blue'='purple'));
#array1->find(match_comparator(\c_compare_contains, -rhs='blue'));

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

beginswith(#right) ? 0 | -1);
/define_tag;

define_tag('c_comparator_endswith', -optional='left', -optional='right');
	return(local_defined('left') && local_defined('right') && #left->endswith(#right) ? 0 | -1);
/define_tag;

define_tag('c_comparator_contains', -optional='left', -optional='right');
	return(local_defined('left') && local_defined('right') && #left->contains(#right) ? 0 | -1);
/define_tag;

define_tag('c_comparator_equalto', -optional='left', -optional='right');
	return(local_defined('left') && local_defined('right') && #left == #right ? 0 | -1);
/define_tag;

define_tag('c_comparator_greaterthan', -optional='left', -optional='right');
	return(local_defined('left') && local_defined('right') && #left > #right ? 0 | -1);
/define_tag;

define_tag('c_comparator_lessthan', -optional='left', -optional='right');
	return(local_defined('left') && local_defined('right') && #left < #right ? 0 | -1);
/define_tag;

define_tag('c_comparator_notcontains', -optional='left', -optional='right');
	return(local_defined('left') && local_defined('right') && #left !>> #right ? 0 | -1);
/define_tag;

define_tag('c_comparator_strictequalto', -optional='left', -optional='right');
	return(local_defined('left') && local_defined('right') && #left === #right ? 0 | -1);
/define_tag;

define_tag('c_comparator_strictnotequalto', -optional='left', -optional='right');
	return(local_defined('left') && local_defined('right') && #left !== #right ? 0 | -1);
/define_tag;
?>

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

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