Skip to content
Repos

DevPlaceApp

C++ 396 B14 lines Opens in site

Directory Raw Download

#pragma once
// Spec: INV-shell 7 (TextCharacterCounter). UTF-16 code unit count, matching the web app and the Swift counters.
#include <string>

namespace dp {

class TextCount {
 public:
  static int utf16(const std::string& utf8);
  // Code point count (approximates Swift String.count, which counts grapheme clusters).
  static int codepoints(const std::string& utf8);
};

}  // namespace dp
38.2ms