Integer to allocatable string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ip), | intent(in) | :: | i |
pure function integer_to_string(i) result(s) integer(ip),intent(in) :: i character(len=:),allocatable :: s integer(ip) :: istat allocate( character(len=MAX_INT_STR_LEN) :: s ) ! should be big enough write(s,fmt='(ss,I0)',iostat=istat) i if (istat==0) then s = trim(adjustl(s)) else s = '***' end if end function integer_to_string