hangul 0.3.0 icon indicating copy to clipboard operation
hangul: ^0.3.0 copied to clipboard

Work with korean hangul characters (한글). Validate characters, split syllables into jamo, merge jamos into syllables.

example/main.dart

import 'package:hangul/hangul.dart';

void main(List<String> arguments) {
  const wordToTransform = "하다";

  // ensure all characters are valid syllables
  wordToTransform.runes.forEach((char) {
    assert(isHangulSyllableCode(char));
  });

  // convert each character to a HangulSyllable instance
  final List<HangulSyllable> syllables =
      wordToTransform.runes.map((e) => HangulSyllable.fromCharCode(e)).toList();

  // replace  the jung (vowel) of each word
  // 하다 will become 후두.
  syllables.forEach((syllable) {
    syllable.jung = 'ㅜ';
  });

  final newWord = syllables.join('');

  print('Word transformed:');
  print(newWord);

  // input hangul characters in the string
  final input = HangulInput(newWord);

  input.pushCharacter('ㄹ');
  input.pushCharacter('ㅡ');
  input.pushCharacter('ㄹ');

  print('String with added input:');
  print(input.text);

  input.backspace();
  input.backspace();
  input.pushCharacter('ㅏ');

  print('String with backspace and replaced input:');
  print(input.text);
}
2
likes
130
pub points
40%
popularity

Publisher

verified publisher iconsouf.fr

Work with korean hangul characters (한글). Validate characters, split syllables into jamo, merge jamos into syllables.

Repository (GitLab)

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

More

Packages that depend on hangul