Commit bc03d470 authored by Matthias Redies's avatar Matthias Redies

added int2str and str2int

parent c36c3752
......@@ -21,4 +21,27 @@ contains
output = input(front:back)
end function strip
function str2int(str) result(int)
implicit none
character(len=*), intent(in) :: str
integer :: int
integer :: stat
read (str, *, iostat=stat) int
if (stat /= 0) then
write (*, *) "str reading failed", str
stop 9
end function str2int
function int2str(num) result(ret_str)
implicit none
integer, intent(in) :: num
character(len=:), allocatable :: ret_str
allocate(character(100) :: ret_str)
write (ret_str,*) num
ret_str = strip(ret_str)
end function int2str
end module m_juDFT_string
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment