Concatenates several copies of an input string.
type(string) :: astring
astring = 'x'
print "(L1)", astring%repeat(5)//''=='xxxxx'
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(in) | :: | self |
String to be repeated. |
||
integer, | intent(in) | :: | ncopies |
Number of string copies. |
Repeated string.
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