View previous topic :: View next topic |
Author |
Message |
Little-Acorn
Joined: 06 Jul 2008 Posts: 111 Location: San Diego
|
Posted: Tue Apr 26, 2011 1:46 am Post subject: How to find if a short string is present in a long string? |
|
|
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 |
|
 |
Little-Acorn
Joined: 06 Jul 2008 Posts: 111 Location: San Diego
|
Posted: Tue Apr 26, 2011 1:48 am Post subject: |
|
|
Whoops! Found it! INDEX is the function. |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Tue Apr 26, 2011 12:24 pm Post subject: |
|
|
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 |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Tue Apr 26, 2011 3:05 pm Post subject: |
|
|
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 |
|
 |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Tue Apr 26, 2011 5:05 pm Post subject: Re: |
|
|
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 |
|
 |
|