hangul 0.2.0 copy "hangul: ^0.2.0" to clipboard
hangul: ^0.2.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 new input:');
  print(input.text);
}
9
likes
0
pub points
66%
popularity

Publisher

verified publishersouf.fr

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

Repository (GitLab)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on hangul