Skip to content

Commit e670262

Browse files
committed
promote public functions to elemental
1 parent 59b195e commit e670262

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

doc/specs/stdlib_ascii.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Converts input character variable to all lowercase.
3838

3939
#### Class
4040

41-
Pure function.
41+
Elemental function.
4242

4343
#### Argument
4444

@@ -74,7 +74,7 @@ Converts input character variable to all uppercase.
7474

7575
#### Class
7676

77-
Pure function.
77+
Elemental function.
7878

7979
#### Argument
8080

@@ -112,7 +112,7 @@ The rest of the character sequence is transformed to lowercase.
112112

113113
#### Class
114114

115-
Pure function.
115+
Elemental function.
116116

117117
#### Argument
118118

@@ -150,7 +150,7 @@ Reverses the order of all characters in the input character type.
150150

151151
#### Class
152152

153-
Pure function.
153+
Elemental function.
154154

155155
#### Argument
156156

src/stdlib_ascii.f90

+4-4
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ end function char_to_upper
213213
!> Convert character variable to lower case
214214
!>
215215
!> Version: experimental
216-
pure function to_lower(string) result(lower_string)
216+
elemental function to_lower(string) result(lower_string)
217217
character(len=*), intent(in) :: string
218218
character(len=len(string)) :: lower_string
219219
integer :: i
@@ -227,7 +227,7 @@ end function to_lower
227227
!> Convert character variable to upper case
228228
!>
229229
!> Version: experimental
230-
pure function to_upper(string) result(upper_string)
230+
elemental function to_upper(string) result(upper_string)
231231
character(len=*), intent(in) :: string
232232
character(len=len(string)) :: upper_string
233233
integer :: i
@@ -241,7 +241,7 @@ end function to_upper
241241
!> Convert character variable to title case
242242
!>
243243
!> Version: experimental
244-
pure function to_title(string) result(title_string)
244+
elemental function to_title(string) result(title_string)
245245
character(len=*), intent(in) :: string
246246
character(len=len(string)) :: title_string
247247
integer :: i, n
@@ -266,7 +266,7 @@ end function to_title
266266
!> Reverse the character order in the input character variable
267267
!>
268268
!> Version: experimental
269-
pure function reverse(string) result(reverse_string)
269+
elemental function reverse(string) result(reverse_string)
270270
character(len=*), intent(in) :: string
271271
character(len=len(string)) :: reverse_string
272272
integer :: i, n

src/tests/ascii/test_ascii.f90

+8
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ subroutine test_to_lower_string
559559

560560
dlc = to_lower("0123456789ABCDE")
561561
call check(dlc == "0123456789abcde")
562+
563+
call check(all(to_lower(["ABC", "DEF"]) == ["abc", "def"]))
562564
end subroutine test_to_lower_string
563565

564566
subroutine test_to_upper_string
@@ -575,6 +577,8 @@ subroutine test_to_upper_string
575577

576578
dlc = to_upper("0123456789abcde")
577579
call check(dlc == "0123456789ABCDE")
580+
581+
call check(all(to_upper(["abc", "def"]) == ["ABC", "DEF"]))
578582
end subroutine test_to_upper_string
579583

580584
subroutine test_to_title_string
@@ -597,6 +601,8 @@ subroutine test_to_title_string
597601

598602
dlc = to_title("""quOTed""")
599603
call check(dlc == """Quoted""")
604+
605+
call check(all(to_title(["abc", "def"]) == ["Abc", "Def"]))
600606
end subroutine test_to_title_string
601607

602608
subroutine test_reverse_string
@@ -611,6 +617,8 @@ subroutine test_reverse_string
611617
call check(len_trim(dlc) == 32)
612618
call check(trim(dlc) == " desrever")
613619
call check(trim(adjustl(dlc)) == "desrever")
620+
621+
call check(all(reverse(["abc", "def"]) == ["cba", "fed"]))
614622
end subroutine test_reverse_string
615623

616624
end program test_ascii

0 commit comments

Comments
 (0)