@@ -838,23 +838,16 @@ defmodule String do
838
838
Converts the first character in the given string to
839
839
uppercase and the remainder to lowercase according to `mode`.
840
840
841
- `mode` may be `:default`, `:ascii` or `:greek`. The `:default`
842
- mode considers all non-conditional transformations outlined in
843
- the Unicode standard. `:ascii` lowercases only the letters A to Z.
844
- `:greek` includes the context sensitive mappings found in Greek.
845
-
846
- More precisely, it converts the first character to titlecase.
847
- If you want to convert only the first character without downcasing
848
- the rest of the string, see `titlecase/2`.
841
+ `mode` may be `:default`, `:ascii` or `:greek`. The `:default` mode considers
842
+ all non-conditional transformations outlined in the Unicode standard. `:ascii`
843
+ lowercases only the letters A to Z. `:greek` includes the context sensitive
844
+ mappings found in Greek.
849
845
850
846
## Examples
851
847
852
848
iex> String.capitalize("abcd")
853
849
"Abcd"
854
850
855
- iex> String.capitalize("OS")
856
- "Os"
857
-
858
851
iex> String.capitalize("fin")
859
852
"Fin"
860
853
@@ -875,54 +868,6 @@ defmodule String do
875
868
char <> downcase ( rest , mode )
876
869
end
877
870
878
- @ doc """
879
- Converts only the first character in the given string to
880
- uppercase according to `mode`.
881
-
882
- `mode` may be `:default`, `:ascii` or `:greek`. The `:default`
883
- mode considers all non-conditional transformations outlined in
884
- the Unicode standard. `:ascii` lowercases only the letters A to Z.
885
- `:greek` includes the context sensitive mappings found in Greek.
886
-
887
- More precisely, it converts the first character to titlecase,
888
- according to the Unicode Standard. This function makes no
889
- attempt to titlecase each word, as those are often language
890
- and locale specific.
891
-
892
- If you want to uppercase the first character and downcase the
893
- rest of the string, see `capitalize/2`.
894
-
895
- ## Examples
896
-
897
- iex> String.titlecase("abcd")
898
- "Abcd"
899
-
900
- iex> String.titlecase("OS")
901
- "OS"
902
-
903
- iex> String.titlecase("fin")
904
- "Fin"
905
-
906
- iex> String.titlecase("olá")
907
- "Olá"
908
-
909
- """
910
- @ spec titlecase ( t , :default | :ascii | :greek ) :: t
911
- def titlecase ( string , mode \\ :default )
912
-
913
- def titlecase ( << char , rest :: binary >> , :ascii ) when char >= ?a and char <= ?z do
914
- << char - 32 , rest :: binary >>
915
- end
916
-
917
- def titlecase ( string , :ascii ) when is_binary ( string ) do
918
- string
919
- end
920
-
921
- def titlecase ( string , mode ) when is_binary ( string ) do
922
- { char , rest } = String.Casing . titlecase_once ( string , mode )
923
- char <> rest
924
- end
925
-
926
871
@ doc false
927
872
@ deprecated "Use String.trim_trailing/1 instead"
928
873
defdelegate rstrip ( binary ) , to: String.Break , as: :trim_trailing
0 commit comments