CamelCase - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

StringTools

 Capitalize
 capitalize each word in a string
 CamelCase
 convert a string to camel case

 Calling Sequence Capitalize( s ) CamelCase( s )

Parameters

 s - Maple string

Description

 • The Capitalize(s) command changes each word in the string s to its capitalized form.
 A word is a maximal sequence of alphanumeric characters delimited by another character, or the beginning or end of the string.
 The capitalized form of a string is the string obtained by replacing each alphabetic character that begins a word with the corresponding uppercase character, and replacing each non-leading alphabetic character in each word with the corresponding lowercase character. Characters that are not part of a word are not affected.
 • The CamelCase(s) command converts a string of concatenated words to camel case. The term camel case refers to the capitalization convention used when forming programming language identifiers from multiple words, in which the first letter of each constituent word is capitalized to aid readability. For example, LinearAlgebraicGroups is a camel case string, whereas linearalgebraicgroups and linear_algebraic_groups follow different conventions.
 Sometimes, a string like linearAlgebraicGroups is also referred to as camel case, wherein only interior word starts are capitalized. This form of camel case can be obtained from the output of CamelCase by converting the first letter of the result to lowercase.
 • All of the StringTools package commands treat strings as (null-terminated) sequences of $8$-bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Capitalize}\left("This is a test."\right)$
 ${"This Is A Test."}$ (1)
 > $\mathrm{Capitalize}\left("hello"\right)$
 ${"Hello"}$ (2)
 > $\mathrm{Capitalize}\left("foo/bar/baz"\right)$
 ${"Foo/Bar/Baz"}$ (3)
 > $\mathrm{CamelCase}\left("camelcase"\right)$
 ${"CamelCase"}$ (4)
 > $\mathrm{CamelCase}\left("linearalgebra"\right)$
 ${"LinearAlgebra"}$ (5)
 > $\mathrm{CamelCase}\left("linearalgebraicgroups"\right)$
 ${"LinearAlgebraicGroups"}$ (6)
 > $\mathrm{LowerCase}\left(\mathrm{CamelCase}\left("linearalgebraicgroups"\right),1..1\right)$
 ${"linearAlgebraicGroups"}$ (7)

There is not always a unique, correct solution to the camel case problem for a given string. In the following example, the result is probably not what was intended.

 > $\mathrm{CamelCase}\left("thecatsatonthemat"\right)$
 ${"TheCatSatOnThemAt"}$ (8)

Since the apostrophe is a word separator, the result in the next example is not the string "Don't"

 > $\mathrm{Capitalize}\left("DON\text{'}T!"\right)$
 ${"Don\text{'}T!"}$ (9)