Capitalize

Capitalize[string]

yields a string in which the first character has been made uppercase.

Capitalize[string,scheme]

gives a string capitalized using the specified capitalization scheme.

Details

  • Capitalize handles both ordinary and special characters.
  • Variant lowercase characters such as \[CurlyPhi] are converted to their nonvariant uppercase forms.
  • Capitalization schemes include:
  • "FirstWord"only the first word in a string
    "AllWords"each word in a string
    "LongWords"all words longer than three characters
    "TitleCase"capitalize all important words

Examples

open allclose all

Basic Examples  (3)

Capitalize the first character of a string:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Capitalize letters of the Greek alphabet:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Use different capitalization schemes on the same string:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=

Scope  (2)

See Also

ToUpperCase  Decapitalize  ToLowerCase

Introduced in 2015
(10.1)
| Updated in 2017
(11.2)