replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - How to find if a short string is present in a long string?
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 

How to find if a short string is present in a long string?

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



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

PostPosted: Tue Apr 26, 2011 1:46 am    Post subject: How to find if a short string is present in a long string? Reply with quote

Is there a brief subroutine or function in FTN95 that can take two strings as arguments, and tell me if String A is present in String B?

If I have:

CHARACTER*5 StringA
CHARACTER*250 StringB
StringA="Hello"
StringB="Is Jim writing yet another Hello World program?"

Is there a function or something, that can return a positive integer value (or a logical .TRUE.) if StringA is present in StringB, as it is in this example?

SCAN won't quite do it - I believe it tells me if any single character from StringB is present in StringA. (correct?)
Back to top
View user's profile Send private message
Little-Acorn



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

PostPosted: Tue Apr 26, 2011 1:48 am    Post subject: Reply with quote

Whoops! Found it! INDEX is the function.
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 506
Location: Sunderland

PostPosted: Tue Apr 26, 2011 12:24 pm    Post subject: Reply with quote

I always find that finding the error in a program is best carried out by asking any random person the question and by the time you have asked it you will have found the answer yourself.
Ian
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2402
Location: Yateley, Hants, UK

PostPosted: Tue Apr 26, 2011 3:05 pm    Post subject: Reply with quote

Not only are there lots of functions in Fortran-90/95, Silverfrost FTN95 contains all (I think) of the additional functions from the Salford FTN77 compiler, which are documented in the FTN77 Library Reference manual, provided online in the documentation section of this website.

Eddie
Back to top
View user's profile Send private message
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Tue Apr 26, 2011 5:05 pm    Post subject: Re: Reply with quote

IanLambley wrote:
I always find that finding the error in a program is best carried out by asking any random person the question and by the time you have asked it you will have found the answer yourself.


This is true - what my esteemed programmer ex-colleague Roger Staff used to refer to as deployment of "the man on the Clapham omnibus". Except he didn't say deployment - dear me, no, such words had mercifully not yet been hijacked into a software context. He did say words like recursive and re-entrant, though, sometimes in conjunction. That used to scare me even more than <whispers> C++</whispers> (sorry, Ian), and still does. The re-entrant word, anyway.
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 -> Support 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