SUIT Framework

Scripting Using Integrated Templates

Docs - escape

06/06/2010: SUIT 2.0.0 and Rulebox 1.0.0 released.

Available Since: SUIT (2.0.0)

Handle escape strings for this position.

Syntax dict suit.escape ( str escapestring, int position, str string [, bool insensitive ] )
Parameters
escapestring

The string to check for behind this position.

position

The position of the open or close string to check for.

string

The full string to check in.

insensitive

Whether or not the searching should be done case insensitively.

Return Value
Key Description
odd bool: Whether or not the count of the escape strings to the left of this position is odd, escaping the open or close string.
position int: The position adjusted to the change in the string.
string str: The string omitting the necessary escape strings.
Examples
Basic Usage
PHP
<?php
require 'suit.class.php';
$suit = new SUIT();
$result = $suit->escape('\\', 1, '\[var]');

/*
Result: array
(
    'position' => 0,
    'odd' => 1,
    'string' => '[var]'
)
*/
?>
Python
import suit
result = suit.escape('\\', 1, '\\[var]')
# Result: {
#     'position': 0,
#     'odd': 1,
#     'string': '[var]'
# }
See Also