2

Is it possible to write a function that compares a list of strings or numbers, or both, and determines which items in the list are uniques?

could someone provide sample code of how that would be done using any of the main languages.

2
  • in solidity I guess ?
    – euri10
    Mar 3, 2016 at 8:46
  • ah yes. i'm also looking for an code example of how to do this of going through an array and checking all the items and returning those which are uniques or filtering out those which have duplicates. Mar 4, 2016 at 13:45

1 Answer 1

1

You can implement a mapping wrapper, that will have "contains" method.

Something like here : https://github.com/ethereum/dapp-bin/blob/master/library/iterable_mapping.sol

1
  • Please consider adding more information to your post as links may break in the future.
    – q9f
    Mar 5, 2016 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.