mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-25 00:48:53 -05:00
Allow capitalization after a period.
This commit is contained in:
parent
9cf956cc96
commit
f75f17b05c
@ -11,8 +11,8 @@ class String
|
|||||||
# capitalize first and last words
|
# capitalize first and last words
|
||||||
x.first.to_s.smart_capitalize!
|
x.first.to_s.smart_capitalize!
|
||||||
x.last.to_s.smart_capitalize!
|
x.last.to_s.smart_capitalize!
|
||||||
# small words after colons are capitalized
|
# small words after colons or periods are capitalized
|
||||||
x.join(" ").gsub(/:\s?(\W*#{small_words.join("|")}\W*)\s/) { ": #{$1.smart_capitalize} " }
|
x.join(" ").gsub(/(:|\.)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
|
||||||
end
|
end
|
||||||
|
|
||||||
def titlecase!
|
def titlecase!
|
||||||
|
Loading…
Reference in New Issue
Block a user