- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
内置的 .Net 方法 TextInfo.ToTitleCase 可以很好地处理法语句子,但有些示例会导致问题,请参阅 remarks (复制如下):
Generally, title casing converts the first character of a word to uppercase and the rest of the characters to lowercase. However, this method does not currently provide proper casing to convert a word that is entirely uppercase, such as an acronym. The following table shows the way the method renders several strings.
Input Language Expected result Actual result war and peace English War and Peace War And Peace Per anhalter durch die Galaxis German Per Anhalter durch die Galaxis Per Anhalter Durch Die Galaxis les naufragés d'ythaq French Les Naufragés d'Ythaq Les Naufragés D'ythaq As illustrated above, the TextInfo.ToTitleCase method provides an arbitrary casing behavior which is not necessarily linguistically correct. A linguistically correct solution would require additional rules, and the current algorithm is somewhat simpler and faster. We reserve the right to make this API slower in the future.
The current implementation of the TextInfo.ToTitleCase method yields an output string that is the same length as the input string. However, this behavior is not guaranteed and could change in a future implementation.
Humanizer 库中是否有一个选项可以用给定的文化标题化?
最佳答案
感觉像是对 Humanizer 的一个很好的补充库,但目前不支持。
如果我要为法语实现标题大小写,我会查看 javascript titlecase-french库并在 C# 中重写它,遵循 rules 的好集它定义:
There are 5 main rules:
- A title always starts with a word in uppercase
- A specific list of words are in lowercase
- After a quote ' words can be in lowercase or uppercase depending of the word before the quote
- Acronyms are in uppercase
- Special uppercase letters (with accent for example) are replaced with their simple version
TextInfo.ToTitleCase
注释 (les naufragés d'ythaq) 中的示例与 titlecase-french
一起正常工作:
console.log(require('titlecase-french').convert("les naufragés d'ythaq"));
// Les Naufragés d'Ythaq
关于c# - Humanizer 法语标题大小写支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28592944/
我们想利用 Humanizer package (因为我们在其他地方使用它)并且不想添加更多类似的库或手工代码。 我有一些时间跨度,其中一些是数千天。我想将它们人性化并将它们转换为年份。现在我很欣赏一
public class Human implements Comparable { private int age; private String name; public
我无法从 Homecontrollers 操作方法调用新的 Human 对象。 var employee = new Human { id = 1, name = "home inde
内置的 .Net 方法 TextInfo.ToTitleCase 可以很好地处理法语句子,但有些示例会导致问题,请参阅 remarks (复制如下): Generally, title casing
为了好玩,我制作了这个牌组洗牌功能来模仿人们如何不完美地洗牌。他们将其切成近两半,并使用“褶边”方法将左右甲板交织在一起,然后重复此过程任意多次。甲板永远不会完美地编织在一起。您可以将它们打乱,如 L
我有一款在线角色扮演游戏,我很认真地对待它。最近我遇到了用户使用假名制作假字符的问题,只是一堆不同的字母。就像 Ghytjrhfsdjfnsdms、Yiiiedawdmnwe、Hhhhhhhhhhej
我正在寻找一种算法,该算法可以告诉我照片/网络摄像头实时Feed上的眼睛在哪里。 我已经进行了很多搜索,但是现在我不想从很多复杂性入手。 只是为了好玩而已。我的想法是要采用某种方法来接收图像并返回与用
为了防止对我的 django 站点的 DOS 类型的攻击,我正在考虑显示一个验证码页面,如果我的网络应用程序经常受到某个 IP 的攻击。类似于当你表现出过多的事件时 SO 正在做的事情。 在 Djan
我正在使用此代码将字节转换为更易读的格式,例如155K, 1.5M, 1.5G,但是从CPAN上的解释看不出转换后的值如何打印到小数点后第二位并四舍五入。谢谢。 use strict; use war
我最近尝试过Humanizer.Js 。我从 here 添加了相同的 nuget 引用,并将其添加到我的页面中,名称为 。但是在我的页面加载中我收到错误:“未捕获类型错误:无法读取未定义的属性‘原型
我正在开发一个 Django 应用程序,它有 LANGUAGE_CODE设置为es西类牙语。 我正在尝试格式化数字在模板中的呈现方式。现在它们呈现为: S/ 18,00当S/ 18.00需要。 我搜索
class Address { private enum Component { NUMBER, STREET, STATE, COUNTRY } pr
我已经成功地使用 Humanizer 将英语单词单数化/复数化, 但当我将 CultureInfo 设置为意大利语时,它只会向单词添加一个额外的“s”。 例如: "Man".Pluralize() =
是否有一个 shell 命令可以简单地在以字节为单位的数字字符串和某些命令通过 -h 提供的“人类可读”的数字字符串之间来回转换选项? 澄清问题:ls -l没有 -h选项(某些输出被抑制) > ls
我已经学习ANTLR几天了。我学习它的目标是我将能够生成解析器和词法分析器,然后亲自将它们从 Java 手动翻译成我的目标语言(C/C++/Java/C#/Python,没有工具支持它)。我选择 AN
我正在使用 Python Humanize module 来格式化一些文件大小信息。该模块默认保留一位小数,有没有办法返回具有不同小数位的值? 这是默认值: >>> humanize.naturals
我想在模板之外使用django.contrib. humanize,实际上是在模型内部使用来人性化一些短信中的某些日期。 这可能吗?我怎样才能做到这一点? 最佳答案 您可以导入模型中的函数: from
PAYCODE_BLUEPAY = "BLUEPAY" PAYCODE_HEARTLAND = "HEARTLAND" PAYCODE_1STPAY = "1STPAYMENT" PAYCODE_CH
希望实现按功能排名/排序,按照我们人类认为相关的方式对产品进行排名,而不是计算机认为相关的方式。目前我有这个sql语句 select MATCH(productName) AGAINST('xyz'
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 7年前关闭。 Improve this qu
我是一名优秀的程序员,十分优秀!