srepeat_string_string Function

private elemental function srepeat_string_string(self, ncopies) result(repeated)

Arguments

TypeIntentOptionalAttributesName
class(string), intent(in) :: self
integer, intent(in) :: ncopies

Return Value type(string)


Called by

proc~~srepeat_string_string~2~~CalledByGraph proc~srepeat_string_string~2 srepeat_string_string interface~repeat~2 repeat interface~repeat~2->proc~srepeat_string_string~2

Contents

Source Code


Source Code

   elemental function srepeat_string_string(self, ncopies) result(repeated)
   !< Concatenates several copies of an input string.
   !<
   !<```fortran
   !< type(string) :: astring
   !< astring = 'x'
   !< print "(L1)", astring%repeat(5)//''=='xxxxx'
   !<```
   !=> T <<<
   class(string), intent(in) :: self     !< String to be repeated.
   integer,       intent(in) :: ncopies  !< Number of string copies.
   type(string)              :: repeated !< Repeated string.
#ifdef _NVF
   character(9999)           :: nvf_bug  !< Work around for NVFortran bug.
#endif

#ifdef _NVF
   nvf_bug = self%raw
   repeated%raw = repeat(string=trim(nvf_bug), ncopies=ncopies)
#else
   repeated%raw = repeat(string=self%raw, ncopies=ncopies)
#endif
   endfunction srepeat_string_string