Skip to content

Commit afe299c

Browse files
committed
Rename interface to to_char
1 parent 9db70ec commit afe299c

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

doc/specs/stdlib_ascii.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ end program demo_reverse
171171
```
172172

173173

174-
### `char_value`
174+
### `to_char`
175175

176176
#### Status
177177

@@ -183,7 +183,7 @@ Create a character string representing the value of the provided variable.
183183

184184
#### Syntax
185185

186-
`res = [[stdlib_ascii(module):char_value(interface)]] (string)`
186+
`res = [[stdlib_ascii(module):to_char(interface)]] (string)`
187187

188188
#### Class
189189

@@ -201,10 +201,10 @@ The result is an intrinsic character type.
201201

202202
```fortran
203203
program demo_char_value
204-
use stdlib_ascii, only : char_value
204+
use stdlib_ascii, only : to_char
205205
implicit none
206-
print'(a)', char_value(-3) ! returns "-3"
207-
print'(a)', char_value(.true.) ! returns "T"
208-
print'(a)', char_value(42) ! returns "42"
206+
print'(a)', to_char(-3) ! returns "-3"
207+
print'(a)', to_char(.true.) ! returns "T"
208+
print'(a)', to_char(42) ! returns "42"
209209
end program demo_char_value
210210
```

src/stdlib_ascii.fypp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ module stdlib_ascii
2020

2121
! Character conversion functions
2222
public :: to_lower, to_upper, to_title, reverse
23-
public :: char_value
23+
public :: to_char
2424

2525
!> Version: experimental
2626
!>
2727
!> Create a character string representing the value of the provided variable.
28-
interface char_value
28+
interface to_char
2929
#:for kind in INT_KINDS
3030
module procedure :: integer_${kind}$_to_char
3131
module procedure :: logical_${kind}$_to_char
3232
#:endfor
33-
end interface char_value
33+
end interface to_char
3434

3535
! All control characters in the ASCII table (see www.asciitable.com).
3636
character(len=1), public, parameter :: NUL = achar(int(z'00')) !! Null

src/tests/ascii/test_ascii.f90

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ program test_ascii
77
is_digit, is_octal_digit, is_hex_digit, is_white, is_blank, &
88
is_control, is_punctuation, is_graphical, is_printable, is_ascii, &
99
to_lower, to_upper, to_title, reverse, LF, TAB, NUL, DEL, &
10-
char_value
10+
to_char
1111
use stdlib_kinds, only : int8, int16, int32, int64
1212

1313
implicit none
@@ -621,43 +621,43 @@ subroutine test_char_value
621621
character(len=128) :: flc
622622

623623
write(flc, '(g0)') 1026192
624-
call check(char_value(1026192) == trim(flc))
624+
call check(to_char(1026192) == trim(flc))
625625

626626
write(flc, '(g0)') -124784
627-
call check(char_value(-124784) == trim(flc))
627+
call check(to_char(-124784) == trim(flc))
628628

629629
write(flc, '(g0)') 1_int8
630-
call check(char_value(1_int8) == trim(flc))
630+
call check(to_char(1_int8) == trim(flc))
631631

632632
write(flc, '(g0)') -3_int8
633-
call check(char_value(-3_int8) == trim(flc))
633+
call check(to_char(-3_int8) == trim(flc))
634634

635635
write(flc, '(g0)') 80_int16
636-
call check(char_value(80_int16) == trim(flc))
636+
call check(to_char(80_int16) == trim(flc))
637637

638638
write(flc, '(g0)') 8924890_int32
639-
call check(char_value(8924890_int32) == trim(flc))
639+
call check(to_char(8924890_int32) == trim(flc))
640640

641641
write(flc, '(g0)') -2378401_int32
642-
call check(char_value(-2378401_int32) == trim(flc))
642+
call check(to_char(-2378401_int32) == trim(flc))
643643

644644
write(flc, '(g0)') -921092378401_int64
645-
call check(char_value(-921092378401_int64) == trim(flc))
645+
call check(to_char(-921092378401_int64) == trim(flc))
646646

647647
write(flc, '(g0)') 1272835771_int64
648-
call check(char_value(1272835771_int64) == trim(flc))
648+
call check(to_char(1272835771_int64) == trim(flc))
649649

650650
write(flc, '(g0)') .true.
651-
call check(char_value(.true.) == trim(flc))
651+
call check(to_char(.true.) == trim(flc))
652652

653653
write(flc, '(g0)') .false.
654-
call check(char_value(.false.) == trim(flc))
654+
call check(to_char(.false.) == trim(flc))
655655

656656
write(flc, '(g0)') .true._int8
657-
call check(char_value(.true._int8) == trim(flc))
657+
call check(to_char(.true._int8) == trim(flc))
658658

659659
write(flc, '(g0)') .false._int64
660-
call check(char_value(.false._int64) == trim(flc))
660+
call check(to_char(.false._int64) == trim(flc))
661661
end subroutine test_char_value
662662

663663
end program test_ascii

0 commit comments

Comments
 (0)