Merge: Factorize `capitalize` and add option to preserve uppercase letters
authorJean Privat <jean@pryen.org>
Fri, 3 Jun 2016 01:44:04 +0000 (21:44 -0400)
committerJean Privat <jean@pryen.org>
Fri, 3 Jun 2016 01:44:04 +0000 (21:44 -0400)
commit72d858ea5860b6f3e6ad58e82e5757d8b9fb8406
tree5c67a5d4a4d392d02a98ccfb23e17b0b08237e86
parentdfddb5c3cee80357371596122f29167ec90349ba
parent7c2aab36b9fe923f0f828e21f703fde98c86ac19
Merge: Factorize `capitalize` and add option to preserve uppercase letters

Merge the duplicated implementation of `String::capitalized` and `Buffer::capitalize` and extend it to accept the `keep_upper` optional parameter. This parameter triggers keeping uppercase letters as is.

It is applied in nitiwiki to preserve acronyms, like the many apparences of FFI at http://nitlanguage.org/FFI/.

Pull-Request: #2085
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
contrib/nitiwiki/src/wiki_base.nit
lib/core/text/abstract_text.nit