StringTools[Border] - compute the border of a string
StringTools[BorderLength] - compute the length of the border of a string
StringTools[BorderArray] - compute a list of border lengths for substrings of a string
|
Calling Sequence
|
|
Border( w )
BorderLength( w )
BorderArray( w )
|
|
Description
|
|
•
|
The Border( w ) command computes the border of a string w. The border of a string (or word) w is the maximal prefix of w that is also a suffix of w.
|
•
|
The BorderLength( w ) command computes only the length of the border of the word w. It is, by definition, equal to length( Border( w ) ), but is more space efficient because the string Border( w ) is not constructed.
|
•
|
The BorderArray( w ) command computes a list of border lengths for the length( w ) substrings of w, where the ith substring consists of the first i characters of w. That is, BorderArray( w ) is equal to .
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
| (9) |
>
|
|
>
|
|
| (10) |
>
|
|
| (11) |
>
|
|
| (12) |
>
|
|
| (13) |
>
|
|
| (14) |
|
|
Download Help Document
Was this information helpful?