Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
pub fn is_balanced(s: &str) -> bool { | |
let mut stack = Vec::new(); | |
for c in s.chars() { | |
match c { | |
'(' | '[' | '{' => stack.push(c), | |
symbol @ (')' | ']' | '}') if stack.pop() != reverse(symbol) => return false, | |
_ => (), | |
} | |
} |