Documentation

unicode punctuation / 全角标点

use upn::is_full_width_punctuation;

#[test]
fn test_is_full_width_punctuation() {
  // 测试常见的中文全角标点
  let chinese_punctuation = vec![
    '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
    '', '', '', '', '', '', '', '', '', '', '', '', '',
  ];

  for &c in &chinese_punctuation {
    assert!(
      is_full_width_punctuation(c),
      "字符 '{}' 应该被识别为中文全角标点",
      c
    );
  }
}

#[test]
fn test_not_is_full_width_punctuation() {
  // 测试非中文全角标点的字符
  let non_punctuation = vec!['a', '1', '.', ',', '-', '_', ' '];

  for &c in &non_punctuation {
    assert!(
      !is_full_width_punctuation(c),
      "字符 '{}' 不应该被识别为中文全角标点",
      c
    );
  }
}

About

This project is an open-source component of i18n.site ⋅ Internationalization Solution.

关于

本项目为 i18n.site ⋅ 国际化解决方案 的开源组件。