home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / fortran / 2886 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  1.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!think.com!Think.COM!sandee
  2. From: sandee@Think.COM (Daan Sandee)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: Assigning numeric variables to strings
  5. Date: 30 Jul 1992 18:00:50 GMT
  6. Organization: TMC
  7. Lines: 16
  8. Distribution: world
  9. Message-ID: <159aoiINNs1k@early-bird.think.com>
  10. References: <Bs7qD3.F70@news.cso.uiuc.edu>
  11. NNTP-Posting-Host: telecaster.think.com
  12.  
  13. In article <Bs7qD3.F70@news.cso.uiuc.edu>, jal41820@uxa.cso.uiuc.edu (Smiley) writes:
  14. |> How can one assign a numeric variable to part of a string (e.g., if 
  15. |> fortran allowed this statement, string(38:39) = int(real) is what I
  16. |> want to do)?
  17.  
  18. Assuming what you want is to have a substring with a *character
  19. representation* of the variable *converted to an integer* :
  20.  
  21.       write(string(38:39),'(i2)') int(x)
  22.  
  23. (Definitely a FAQ, about once a week, luckily not one which creates a
  24. hundred postings with misinformation and miscellaneous complaints.)
  25.  
  26. Daan Sandee                                           sandee@think.com
  27. Thinking Machines Corporation
  28. Cambridge, Mass 02142                                 (617) 234-5044
  29.