.net - .NET String.Split 对于非拉丁字符出现故障
问题描述
试图将段落分成句子:我的文本是混合拉丁和亚美尼亚字母字符;当我调用 String.Split 时,拆分位置错误。我试图拆分句号/问号/感叹号。这可能是 .NET 中的错误吗?还是我错过了什么?
链接到 DotNetFiddle。如果您运行该代码,您会看到第一句话是“The Temple of Garni(亚美尼亚语:Գառնիիտաճար”,这是错误的,它只是第一句话的一部分。
string combinedParas = @"The Temple of Garni (Armenian: Գառնիի տաճար, Gaṙnii tačar, [ˈgɑrnii ˈtɑtʃɑʁ])[a] is the only standing Greco-Roman colonnaded building in Armenia and the former Soviet Union. Built in the Ionic order in the village of Garni, Armenia, it is the best-known structure and symbol of pre-Christian Armenia.";
var sentences = combinedParas.Split(new[] { ',', '?', '!' }, StringSplitOptions.RemoveEmptyEntries);
foreach(var s in sentences) {
Console.WriteLine(s);
主要是出于好奇而询问;我已经继续前进并编写了自己的拆分函数来处理手头的问题。
解决方案
推荐阅读
- java - 仅在横向模式下强制旋转屏幕
- node.js - DA Node Bindings Tutorial -- 'retrieve the package identifiers' 问题
- kotlin - 如何从派生类访问数组元素
- python - 在 python 中抓取 Remax.com
- r - 地图功能的不同结果
- wordpress - 如何扩展 TimberPost
- asp.net-mvc - 必须两次需要 Vue 组件
- javascript - 在 Laravel 中过滤没有 if 语句的数据库
- micropython - esptool.py 不是内部或外部命令、可运行程序或批处理文件
- javascript - 将多个事件添加到同一函数会导致超出最大堆栈大小