0

I need a way to search for Unicode code points by the name of the code point in Swift/Objective-C on iOS. So if a user types "shade" it would find code points containing the word shade, like U+2591 through U+2593. What would be the most efficient way to do this?

Addison
  • 3,791
  • 3
  • 28
  • 48
  • Here is a public index for codepoint names: http://stackoverflow.com/a/25346064/2057171 – Albert Renshaw Mar 17 '16 at 14:55
  • 1
    For anyone who cares, I ended up finding this link http://unicode.org/Public/UNIDATA/NamesList.txt which I used to create a database of all the value, and I can search for values in it pretty quickly – Addison Mar 20 '16 at 02:34
  • The fact that this question was closed as "opinion based" is very odd... Voting for reopen. – Albert Renshaw Mar 20 '16 at 02:45

1 Answers1

1

You'd need to keep a database of the unicode codepoint information, indexed by name.

You're never going to make this massively efficient, because you're doing a "contains" search. You can't use computer-science tricks like binary search or trees to do this. Ultimately, all the names have to be walked through.

matt
  • 515,959
  • 87
  • 875
  • 1,141