Balanced brackets: Difference between revisions

m
Fixed bug
(Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag)
m (Fixed bug)
Line 3,335:
include "NSLog.incl"
 
local fn BracketBalance( strWithBracketsstrWithBracket as CFStringRef ) as CFStringRef
NSInteger i, bracketTracker = 0
CFStringRef result
Line 3,341:
CFCharacterSetRef bracketSet = fn CharacterSetWithCharactersInString( @"[]" )
CFCharacterSetRef bracketsOnlySet = fn CharacterSetInvertedSet( bracketSet )
CFStringRefCFArrayRef trimmedStr trimmedSArray = fn StringByTrimmingCharactersInSetStringComponentsSeparatedByCharactersInSet( strWithBracketsstrWithBracket, bracketsOnlySet )
CFStringRef trimmedStr = fn ArrayComponentsJoinedByString( trimmedSArray, @"" )
NSUInteger strLen = len( trimmedStr )
721

edits