find the matching fence character to one in a string of text - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Names and Strings : StringTools Package : WhiteSpace Utilities : StringTools/MatchFence

StringTools[MatchFence] - find the matching fence character to one in a string of text

Calling Sequence

MatchFence( s, pos )

Parameters

s

-

string; string to examine

pos

-

posint; the position of a fence character in the string s

Description

• 

The MatchFence procedure locates the matching fence character to one specified in the input text s by its position pos. It returns the position, in s, of the matching fence character if present, or 0 otherwise. If spos is not a fence character, that is, not one of (,),[,],{,}, an exception is raised.

Examples

withStringTools:

MatchFenceab{cde}fg,3

7

(1)

n:=MatchFenceab(cde)fg,3

n:=7

(2)

MatchFenceab(cde)fg,n

3

(3)

MatchFenceab(cde)fg,1

Error, (in StringTools:-MatchFence) the character `a' is not a fence character

MatchFenceab[cdefg,3

0

(4)

MatchFenceab{cde]fg,3

0

(5)

See Also

string, StringTools, StringTools[IsBalanced]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam