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 

Picking a substring out of a string in FTN95 (Win32)?

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



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Wed Jul 28, 2010 1:33 am    Post subject: Picking a substring out of a string in FTN95 (Win32)? Reply with quote

I'm running FTN95, with WIN32.

Years ago when I was running BASIC (don't laugh, it has its uses), it had a function where I could pick a group of character out of a string, and assign them into a substring. Something like:

SUBSTRING$=MID$("Fourscore and seven years ago",5,9)

would assign the characters "score and" into the string variable SUBSTRING$.

Can FTN95 do anything like that?

-----------------------------------------------------------

BASIC also had two related functions such as:

SUBSTRING$=LEFT$("Fourscore and seven years ago",6)

which would put the string "Foursc" into STRING$, and

SUBSTRING$=RIGHT$("Fourscore and seven years ago",7)

which would put the string "ars ago" into STRING$.

Do any functions similar to that, exist in FTN95?

Thanks in advance!
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Wed Jul 28, 2010 7:52 am    Post subject: Reply with quote

http://www.infis.univ.trieste.it/fortran/thetypec.html

An extract from the web page above:-


If the CHARACTER variable LANG has the value 'FORTRAN', some substrings are:
Code:

Substring   Value       

LANG(1:1)   'F'         

LANG(1:7)   'FORTRAN'   

LANG(2:3)   'OR'         

LANG(7:7)   'N'         

LANG(:4)    'FORT'       

LANG(5:)    'RAN'   


or you could write your own fortran routines to mimic basic
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7925
Location: Salford, UK

PostPosted: Wed Jul 28, 2010 7:55 am    Post subject: Reply with quote

Use INDEX and then put the result into a Fortran character substring.
Back to top
View user's profile Send private message AIM Address
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Wed Jul 28, 2010 9:39 pm    Post subject: Reply with quote

Great, thank you!
Back to top
View user's profile Send private message
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