Skip to content

Instantly share code, notes, and snippets.

@rymawby
Last active November 28, 2016 09:40
Show Gist options
  • Save rymawby/3c8ce06917897d332eb63f1a79d12678 to your computer and use it in GitHub Desktop.
Save rymawby/3c8ce06917897d332eb63f1a79d12678 to your computer and use it in GitHub Desktop.
Brightscript string dupe checker
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