|
Previous Top Next |
Prototype: | (String pS),Short |
pS | String to test |
Returns | Number of mismatching parenthesis |
This method counts opening parenthesis and closing parenthesis and returns the difference. If the parenthesis are matched, the return value should be zero. If there are more opening parenthesis than closing parenthesis, the return value will be a positive number. If there are more closing parenthesis than opening parenthesis, the return value will be negative.
Example:
ITS ITStringClass
S String(1024)
Code
S = '1*(123/(12/4))+(23*54)'
Message('MatchParenthesis = ' & ITS.MatchParenthesis(S)) ! Should return 0
S = '1*(123/(12/4))+(23*54'
Message('MatchParenthesis = ' & ITS.MatchParenthesis(S)) ! Should return 1
S = '1*123/(12/4))+(23*54'
Message('MatchParenthesis = ' & ITS.MatchParenthesis(S)) ! Should return -1
See also: