|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Zach
Joined: 13 Mar 2023 Posts: 85 Location: Groningen, Netherlands
|
Posted: Thu Apr 27, 2023 9:57 pm Post subject: trim(string) does not work |
|
|
trim(string) -> the compiler does not recognise the statement. If someone does get it to work, please post an example. I could not find anything on the Internet that might point out why compiling the statement produced an error. |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 726 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Fri Apr 28, 2023 12:32 am Post subject: |
|
|
Code: | program trim_string_works
character(len=30) name
name = 'Casper the Jack Russell '
write(6,*) len(name)
write(6,*) len(trim(name))
write(6,'(A)') '123456789012345678901234567890'
write(6,'(2A)') name,'X'
write(6,'(2A)') trim(name),'X'
end program trim_string_works |
|
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 726 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Fri Apr 28, 2023 11:53 am Post subject: |
|
|
A better example:
Code: | program trim_string_works
character(len=30) name, breed
name = 'Casper '
breed = 'Jack Russell terrier'
write(6,'(A,1X,A,1X,A)') name, 'is a', breed
write(6,*)
write(6,'(A,1X,A,1X,A)') trim(name), 'is a', breed
end program trim_string_works |
Code: | Casper is a Jack Russell terrier
Casper is a Jack Russell terrier
Press RETURN to close window... |
|
|
Back to top |
|
|
Zach
Joined: 13 Mar 2023 Posts: 85 Location: Groningen, Netherlands
|
Posted: Fri Apr 28, 2023 1:20 pm Post subject: |
|
|
Thank you for your very explanatory response to my query! Patrick |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|