Next: , Previous: , Up: strings   [Contents][Index]


14.6 Comparing strings

Function: mbfl_string_equal str1 str2

Return successfully if the arguments are equal when lexicographically compared as strings; otherwise return unsuccessfully. Examples:

mbfl_string_equal '' ''                 ⇒ 0
mbfl_string_equal 'a' ''                ⇒ 1
mbfl_string_equal '' 'a'                ⇒ 1
mbfl_string_equal 'ciao' 'ciao'         ⇒ 0
mbfl_string_equal 'ciao' 'hello'        ⇒ 1
Function: mbfl_string_not_equal str1 str2

Return successfully if the arguments are not equal when lexicographically compared as strings; otherwise return unsuccessfully.

Function: mbfl_string_is_yes str
Function: mbfl_string_is_no str

Return true if the string str is equal to, respectively, ‘yes’ or ‘no’; otherwise return false.

Function: mbfl_string_less str1 str2

Return successfully if str1 is less than str2 when lexicographically compared as strings; otherwise return unsuccessfully. Examples:

mbfl_string_less '' ''                  ⇒ 0
mbfl_string_less 'a' ''                 ⇒ 0
mbfl_string_less '' 'a'                 ⇒ 1
mbfl_string_less 'ciao' 'ciao'          ⇒ 1
mbfl_string_less 'ciao' 'hello'         ⇒ 0
mbfl_string_less 'hello' 'ciao'         ⇒ 1
Function: mbfl_string_greater str1 str2

Return successfully if str1 is greater than str2 when lexicographically compared as strings; otherwise return unsuccessfully. Examples:

mbfl_string_greater '' ''               ⇒ 1
mbfl_string_greater 'a' ''              ⇒ 0
mbfl_string_greater '' 'a'              ⇒ 1
mbfl_string_greater 'ciao' 'ciao'       ⇒ 1
mbfl_string_greater 'ciao' 'hello'      ⇒ 1
mbfl_string_greater 'hello' 'ciao'      ⇒ 0
Function: mbfl_string_less_or_equal str1 str2

Return successfully if str1 is less than, or equal to, str2 when lexicographically compared as strings; otherwise return unsuccessfully. Examples:

mbfl_string_less_or_equal '' ''                 ⇒ 0
mbfl_string_less_or_equal 'a' ''                ⇒ 1
mbfl_string_less_or_equal '' 'a'                ⇒ 0
mbfl_string_less_or_equal 'ciao' 'ciao'         ⇒ 0
mbfl_string_less_or_equal 'ciao' 'hello'        ⇒ 0
mbfl_string_less_or_equal 'hello' 'ciao'        ⇒ 1
Function: mbfl_string_greater_or_equal str1 str2

Return successfully if str1 is greater than, or equal to, str2 when lexicographically compared as strings; otherwise return unsuccessfully. Examples:

mbfl_string_greater_or_equal '' ''              ⇒ 0
mbfl_string_greater_or_equal 'a' ''             ⇒ 0
mbfl_string_greater_or_equal '' 'a'             ⇒ 1
mbfl_string_greater_or_equal 'ciao' 'ciao'      ⇒ 0
mbfl_string_greater_or_equal 'ciao' 'hello'     ⇒ 1
mbfl_string_greater_or_equal 'hello' 'ciao'     ⇒ 0
Function: mbfl_string_equal_substring string position pattern

Return true if the substring starting at position in string is equal to pattern; else return false. If position plus the length of pattern is greater than the length of string: the return value is false, always.


Next: , Previous: , Up: strings   [Contents][Index]

This document describes version 3.0.0-devel.0 of Marcos Bash Functions Library.