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


14.1 Quoted characters

Function: mbfl_string_is_quoted_char string position

Return true if the character at position in string is quoted; else return false. A character is considered quoted if it is preceded by an odd number of backslashes (\). position is a zero–based index.

mbfl_string_is_quoted_char 'abcdefg'  3 ;$? ⇒ 1
mbfl_string_is_quoted_char 'ab\cdefg' 3 ;$? ⇒ 0
mbfl_string_is_quoted_char 'ab\ndefg' 3 ;$? ⇒ 0
Function: mbfl_string_is_equal_unquoted_char string position char

Return true if the character at position in string is equal to char and is not quoted (according to mbfl_string_is_quoted_char()); else return false. position is a zero–based index.

mbfl_string_is_equal_unquoted_char abcdefg 3 d
;$? ⇒ 0

mbfl_string_is_equal_unquoted_char 'abc\defg' 3 d
;$? ⇒ 1
Function: mbfl_string_quote string
Function: mbfl_string_quote_var _RV string

Print string with quoted characters. All the occurrences of the backslash character, \, are substituted with a quoted backslash, \\. Return true.

The function variant _var stores the result in the variable _RV, rather than print it; Result variables.

mbfl_string_quote \\a\\b\\c     -| \\\\a\\\\b\\\\c
mbfl_string_quote abc           -| abc
mbfl_string_quote "a b\tc\n\r"  -| a\ b\\\\tc\\\\n\\\\r

local _RV
mbfl_string_quote_var _RV \\a\\b\\c
"$_RV"   ⇒ \\\\a\\\\b\\\\c

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

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