QuickSnip LogoA light blue logo with a thunderbolt in bracketsQuickSnip

Find Unique Characters

Returns a set of unique characters from a string, with options to include spaces and control case sensitivity

  • string
  • unique
  • characters
  • case-sensitive

Code

def find_unique_chars(s):
    return ''.join(sorted(set(s)))

Usage

System.out.println(findUniqueCharacters("hello world", false, true)); // Output: [d, e, h, l, o, r, w]