srepeat_string_string Function

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

Concatenates several copies of an input string.

 type(string) :: astring
 astring = 'x'
 print "(L1)", astring%repeat(5)//''=='xxxxx'

Type Bound

string

Arguments

Type IntentOptional Attributes Name
class(string), intent(in) :: self

String to be repeated.

integer, intent(in) :: ncopies

Number of string copies.

Return Value type(string)

Repeated string.


Called by

proc~~srepeat_string_string~~CalledByGraph proc~srepeat_string_string stringifor_string_t::string%srepeat_string_string interface~repeat stringifor_string_t::repeat interface~repeat->proc~srepeat_string_string

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