camelcase Function

private elemental function camelcase(self, sep)

Type Bound

string

Arguments

Type IntentOptional Attributes Name
class(string), intent(in) :: self
character(kind=CK, len=*), intent(in), optional :: sep

Return Value type(string)


Calls

proc~~camelcase~~CallsGraph proc~camelcase string%camelcase none~join string%join proc~camelcase->none~join proc~capitalize string%capitalize proc~camelcase->proc~capitalize proc~split string%split proc~camelcase->proc~split proc~join_characters string%join_characters none~join->proc~join_characters proc~join_strings string%join_strings none~join->proc~join_strings proc~lower string%lower proc~capitalize->proc~lower proc~partition string%partition proc~split->proc~partition proc~unique string%unique proc~split->proc~unique proc~replace string%replace proc~unique->proc~replace proc~replace_one_occurrence string%replace_one_occurrence proc~replace->proc~replace_one_occurrence

Called by

proc~~camelcase~~CalledByGraph proc~camelcase string%camelcase program~volatile_doctest~1054 volatile_doctest program~volatile_doctest~1054->proc~camelcase program~volatile_doctest~560 volatile_doctest program~volatile_doctest~560->proc~camelcase

Source Code

   elemental function camelcase(self, sep)
   !< Return a string with all words capitalized without spaces.
   !<
   !< @note Multiple subsequent separators are collapsed to one occurence.
   !<
   !<```fortran
   !< type(string) :: astring
   !< astring = 'caMeL caSe var'
   !< print '(L1)', astring%camelcase()//''=='CamelCaseVar'
   !<```
   !=> T <<<
   class(string),             intent(in)           :: self      !< The string.
   character(kind=CK, len=*), intent(in), optional :: sep       !< Separator.
   type(string)                                    :: camelcase !< Camel case string.
   type(string), allocatable                       :: tokens(:) !< String tokens.

   if (allocated(self%raw)) then
     call self%split(tokens=tokens, sep=sep)
     tokens = tokens%capitalize()
     camelcase = camelcase%join(array=tokens)
   endif
   endfunction camelcase