Replies: 1 comment 1 reply
-
to_string (
https://stdlib.fortran-lang.org/page/specs/stdlib_strings.html#to_string)
is most likely what you are looking for
Le sam. 10 sept. 2022 à 19:18, HugoMVale ***@***.***> a
écrit :
… Hello,
Is there a stdlib function which allows to convert an integer to a
character vector (opposite of ichar if I understand well)?
I mean, something more or less like:
function itoa(i) result(res)
!------------------------------------------------------------------------------------------
!! Convert integer to string.
!------------------------------------------------------------------------------------------
integer, intent(in) :: i
!! Integer
character(:), allocatable :: res
character(range(i)+2) :: tmp
write(tmp,'(i0)') i
res = trim(tmp)
end function
Thanks for any hint.
—
Reply to this email directly, view it on GitHub
<#676>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD5RO7DPT62PJHDVC4ZNETTV5S7H7ANCNFSM6AAAAAAQJNEVHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Is there a stdlib function which allows to convert an integer to a character vector (opposite of
ichar
if I understand well)?I mean, something more or less like:
Thanks for any hint.
Beta Was this translation helpful? Give feedback.
All reactions