Last active
November 28, 2016 09:40
-
-
Save rymawby/3c8ce06917897d332eb63f1a79d12678 to your computer and use it in GitHub Desktop.
Brightscript string dupe checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DupeChecker() as Object | |
this = {} | |
this.dupes = [] | |
this.addItem = function(item as String, isPrintOnFoundDupe = false as Boolean) as Boolean | |
isDupe = m.checkIsDupe(item) | |
m.dupes.push(item) | |
if isPrintOnFoundDupe then | |
print item | |
end if | |
return isDupe | |
end function | |
this.checkIsDupe = function(item as String) as Boolean | |
isDupe = false | |
for i = 0 to m.dupes.count() - 1 | |
if m.dupes[i] = item then | |
isDupe = true | |
end if | |
end for | |
return isDupe | |
end function | |
this.clear = function() as Void | |
m.dupes = Invalid | |
m.dupes = [] | |
end function | |
return this | |
end function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment