单数转复数 "abc".pluralize ---> abcs
复数转单数 "abcs".singularize ---> abc

转变类 "abcs".classify --> Abc

下划线命名: 'UserRole'.underscore = user_role
Title命名: 'UserRole'.titlecase = User Role

module ActiveSupport  Inflector.inflections do |inflect|    inflect.plural(/$/, 's')    inflect.plural(/s$/i, 's')    inflect.plural(/(ax|test)is$/i, '\1es')    inflect.plural(/(octop|vir)us$/i, '\1i')    inflect.plural(/(alias|status)$/i, '\1es')    inflect.plural(/(bu)s$/i, '\1ses')    inflect.plural(/(buffal|tomat)o$/i, '\1oes')    inflect.plural(/([ti])um$/i, '\1a')    inflect.plural(/sis$/i, 'ses')    inflect.plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves')    inflect.plural(/(hive)$/i, '\1s')    inflect.plural(/([^aeiouy]|qu)y$/i, '\1ies')    inflect.plural(/(x|ch|ss|sh)$/i, '\1es')    inflect.plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices')    inflect.plural(/([m|l])ouse$/i, '\1ice')    inflect.plural(/^(ox)$/i, '\1en')    inflect.plural(/(quiz)$/i, '\1zes')

    inflect.singular(/s$/i, '')    inflect.singular(/(n)ews$/i, '\1ews')    inflect.singular(/([ti])a$/i, '\1um')    inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i, '\1\2sis')    inflect.singular(/(^analy)ses$/i, '\1sis')    inflect.singular(/([^f])ves$/i, '\1fe')    inflect.singular(/(hive)s$/i, '\1')    inflect.singular(/(tive)s$/i, '\1')    inflect.singular(/([lr])ves$/i, '\1f')    inflect.singular(/([^aeiouy]|qu)ies$/i, '\1y')    inflect.singular(/(s)eries$/i, '\1eries')    inflect.singular(/(m)ovies$/i, '\1ovie')    inflect.singular(/(x|ch|ss|sh)es$/i, '\1')    inflect.singular(/([m|l])ice$/i, '\1ouse')    inflect.singular(/(bus)es$/i, '\1')    inflect.singular(/(o)es$/i, '\1')    inflect.singular(/(shoe)s$/i, '\1')    inflect.singular(/(cris|ax|test)es$/i, '\1is')    inflect.singular(/(octop|vir)i$/i, '\1us')    inflect.singular(/(alias|status)es$/i, '\1')    inflect.singular(/^(ox)en/i, '\1')    inflect.singular(/(vert|ind)ices$/i, '\1ex')    inflect.singular(/(matr)ices$/i, '\1ix')    inflect.singular(/(quiz)zes$/i, '\1')    inflect.singular(/(database)s$/i, '\1')

    inflect.irregular('person', 'people')    inflect.irregular('man', 'men')    inflect.irregular('child', 'children')    inflect.irregular('sex', 'sexes')    inflect.irregular('move', 'moves')    inflect.irregular('cow', 'kine')

    inflect.uncountable(%w(equipment information rice money species series fish sheep jeans))  endend

rails 单复数转换相关推荐

  1. java英文单词单复数转换

    package steam;import java.util.*; import java.util.regex.*; /*** * 单复数转换类* 2018年12月30日*/public class ...

  2. php 日期单数 复数,参考ROR中的单复数转换,写一个PHP的单复数转换类

    1.[代码]参考ROR中的单复数转换,写一个PHP的单复数转换类$inflector = new Inflector(); echo $inflector->pluralize('bus') . ...

  3. 常见的有规律的单复数转换(随笔)

    1.以-a结尾的拉丁语名词,词尾变为-ae或-as formula → 复数:formulae/formulas n公式 alumna → 复数:alumnae n女校友,女毕业生 antenna → ...

  4. 单数复数php单元格背景颜色,PHP-php 如何实现 英语单词 单复数 转换

    提供一个单数转复数的函数给你: /** * 单词单数转成复数 * @param $string 单词单数 */ function pluralize( $string ) { $plural = ar ...

  5. php英语单词出现了几次,PHP如何实现英语单词 单复数 转换?

    提供一个单数转复数的函数给你: /** * 单词单数转成复数 * @param $string 单词单数 */ function pluralize( $string )  { $plural = a ...

  6. Rails启动项一些参数的调整

    关闭冗余日志信息 首先在config/initializers目录中的backtrace_silencers.rb里可以按需或者全部关闭不必要的错误栈回溯信息,以免你日志拖的太长: //过滤特定lib ...

  7. Ruby on rails 实战圣经:Part 2: 深度剖析环境设定与Bundler

    Complication is WhatHappens When You Try to Solve a Problem You Don't Understand - Andy Boothe 目录结构 ...

  8. rails 代码结构详解

    目录结构 这一节让我们走访一个 Rails的目录结构: app/ app 目录是你主要工作的地方,不同子目录存储了 Models.Controllers.Views.Helpers和 Assets 等 ...

  9. Ruby on rails 实战圣经: 深度剖析环境设定与Bundler

    Complication is WhatHappens When You Try to Solve a Problem You Don't Understand - Andy Boothe 目录结构 ...

最新文章

  1. treeselect 如何选中多个_word使用技巧之-如何让你工作效率翻倍提升
  2. Endnote在latex中的应用的两种方法
  3. 三层交换机工作原理(转载)
  4. 《从零开始学Swift》学习笔记(Day 55)——使用try?和try!区别
  5. Winform(C#)输入完毕后,按Enter键触发Button事件
  6. Hibernate第十一篇【配置C3P0数据库连接池、线程Session】
  7. java 抛出异常_我的Java Web之路51 - Java异常基础
  8. 手机当中的wifi功能是什么意思?
  9. java定义数字类型的代码_数字类型内置方法(示例代码)
  10. 首款基于龙芯的域名系统服务器发布,首款基于龙芯CPU的国产域名服务器发布
  11. Android 4.0以上设备虚拟按键中显示Menu键
  12. css实现六边形图片(最简单易懂方法实现高逼格图片展示)
  13. 云服务器显示异地登录,云服务器异地登录异常
  14. 靖哥哥教你如何安装chrome浏览器离线插件
  15. 微云虚拟化VOS操作系统
  16. uni-app通过wifi连接设备并进行命令交互
  17. 关于 Web3.0前端工程师需要具备哪些技术?
  18. mongodb性能优化
  19. Flash Play 闪玩
  20. EDID是什么?为什么要使用它?和DDC的关系?

热门文章

  1. Android 自定义Camera(一)如何预览相机
  2. ESP8266EX 串口WIFI无线模块
  3. 【tio-core】1、tio-study是学习t-io的第一步
  4. tio-websocket-server 源码浅析
  5. 学校信息管理系统数据库模型设计
  6. Mac中pycharm安装低版本tensorflow1.8的方法
  7. SVG滤镜波浪动画效果
  8. Man Is Here For The Sake of Other Men 人是为了别人而活着
  9. 计算机图形学博士论文,关于计算机图形学探究的论文(2)
  10. unity3d播放透明mov格式视频的一种方式