srepeat_character_string Function

private elemental function srepeat_character_string(rstring, ncopies) result(repeated)

Concatenates several copies of an input string.

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

Type Bound

string

Arguments

Type IntentOptional Attributes Name
character(kind=CK, len=*), intent(in) :: rstring

String to be repeated.

integer, intent(in) :: ncopies

Number of string copies.

Return Value type(string)

Repeated string.


Contents


Source Code

   elemental function srepeat_character_string(rstring, ncopies) result(repeated)
   !< Concatenates several copies of an input string.
   !<
   !<```fortran
   !< type(string) :: astring
   !< astring = 'y'
   !< print "(L1)", astring%repeat('x', 5)//''=='xxxxx'
   !<```
   !=> T <<<
   character(kind=CK, len=*), intent(in) :: rstring  !< String to be repeated.
   integer,                   intent(in) :: ncopies  !< Number of string copies.
   type(string)                          :: repeated !< Repeated string.

   repeated%raw = repeat(string=rstring, ncopies=ncopies)
   endfunction srepeat_character_string