Screamer Project  V3.3.1
Screamer Structure
 All Files Functions Variables
int2txt.f
Go to the documentation of this file.
1  subroutine int_to_text (int ,text)
2 c
3 c Converts an integer to its character representation (up to
4 c 10 digits). If the character string is longer than
5 c required, it will be padded with blanks on the right.
6 c
7 c Define passed variables
8 c
9  integer int
10  character*(*) text
11 c
12 c Define internal variables
13 c
14  integer num, ichar_cnt, idig, icode
15  logical leading_digit
16 c
17 c initialize variables
18 c
19  text = ' '
20  ichar_cnt = 0
21  num = int
22  leading_digit = .true.
23 c
24 c Loop 10 times, once for each possible digit
25 c
26  do i = 9, 0, -1
27  idig = num / (10**i)
28 c
29 c If this is the first significant digit, or if this is
30 c a zero embedded within the number, convert it to
31 c a character and append it to the character string
32 c
33  if ((idig .ne. 0) .or. (.not.leading_digit)) then
34  ichar_cnt = ichar_cnt + 1
35  icode = idig + 48
36  text(ichar_cnt:ichar_cnt) = char(icode)
37  num = num - (idig*10**i)
38  leading_digit = .false.
39  endif
40  enddo
41 c
42  return
43  end
subroutine int_to_text(int, text)
Definition: int2txt.f:1