elemental function snakecase(self, sep)
!< Return a string with all words lowercase separated by "_".
!<
!< @note Multiple subsequent separators are collapsed to one occurence.
!<
!<```fortran
!< type(string) :: astring
!< logical :: test_passed(1)
!< astring = 'the Quick Brown fox Jumps over the Lazy Dog.'
!< test_passed(1) = astring%snakecase()//''=='the_quick_brown_fox_jumps_over_the_lazy_dog.'
!< print '(L1)', all(test_passed)
!<```
!=> T <<<
class(string), intent(in) :: self !< The string.
character(kind=CK, len=*), intent(in), optional :: sep !< Separator.
type(string) :: snakecase !< Snake case string.
type(string), allocatable :: tokens(:) !< String tokens.
if (allocated(self%raw)) then
call self%split(tokens=tokens, sep=sep)
tokens = tokens%lower()
snakecase = snakecase%join(array=tokens, sep='_')
endif
endfunction snakecase