soccer jersey forums.silverfrost.com :: View topic - trim(string) does not work
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

trim(string) does not work

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Zach



Joined: 13 Mar 2023
Posts: 85
Location: Groningen, Netherlands

PostPosted: Thu Apr 27, 2023 9:57 pm    Post subject: trim(string) does not work Reply with quote

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
View user's profile Send private message Send e-mail
Kenneth_Smith



Joined: 18 May 2012
Posts: 726
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Fri Apr 28, 2023 12:32 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Kenneth_Smith



Joined: 18 May 2012
Posts: 726
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Fri Apr 28, 2023 11:53 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Zach



Joined: 13 Mar 2023
Posts: 85
Location: Groningen, Netherlands

PostPosted: Fri Apr 28, 2023 1:20 pm    Post subject: Reply with quote

Thank you for your very explanatory response to my query! Patrick
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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