Documentation ¶
Overview ¶
Package nested provides functions for testing strings proper brackets nesting.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBalanced ¶
IsBalanced returns true if provided input string is properly nested.
Input is a sequence of brackets: '(', ')', '[', ']', '{', '}'.
A sequence of brackets `s` is considered properly nested if any of the following conditions are true:
- `s` is empty;
- `s` has the form (U) or [U] or {U} where U is a properly nested string;
- `s` has the form VW where V and W are properly nested strings.
For example, the string "()()[()]" is properly nested but "[(()]" is not.
**Note** Providing characters other then brackets would return false, despite brackets sequence in the string. Make sure to filter input before usage.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.