View previous topic :: View next topic |
Author |
Message |
christyleomin
Joined: 08 Apr 2011 Posts: 155
|
Posted: Tue Jul 05, 2011 11:09 am Post subject: Fortran familiarization |
|
|
Hello,
Please can anyone tell me the meaning of this;
propty1 = propty(1:np)//'EXP'
Please note that propty and propty1 are of type character.
Does it mean that if propty is 'SOMETHING' then propty1 will be 'SOMETHINGEXP'??
Please help |
|
Back to top |
|
|
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: Düsseldorf, Germany
|
Posted: Tue Jul 05, 2011 12:58 pm Post subject: |
|
|
YES. But - why don't you test it?
Code: | PROGRAM TEST
character*120 propty,propty1
propty = 'hello_dolly'
propty1 = propty(1:6)//'anne'
print*,propty1
end |
Regards - Wilfried |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Tue Jul 05, 2011 1:00 pm Post subject: |
|
|
Yes, but only if np = 9. If np is less that 9, say 4, you will get 'SOMEEXP'.
I suspect that your fragment of code is taking a filename and adding an extension. It may well be a filename with a path and a driveletter as well. Just guessing, but is np calculated from
np=LEN_TRIM(PROPTY)
If PROPTY was a proper filename already with an extension, then you might have to knock off up to 3 characters to get rid of that. Another way would be to read back from the end of the character string until you came to the dot. FTN95 has SET_SUFFIX@ and SET_SUFFIX1@ library routines for doing this job with less things to think about.
The // concatenation operator is particularly useful for splicing in invisible characters, e.g. //CHAR(10)//
Eddie |
|
Back to top |
|
|
|