Re: index function problem



Hi,

This is a fixed version (the appearance may be altered by the forum):

character(len=150) :: text='IF A PROGRAMMER IS FOUND TO BE
INDISPENSABLE,&
&THE BEST THING TO DO IS TO GET RID OF HIM AS SOON AS POSSIBLE'
!character(80) :: text='IS A PROGRAMMER IS'
character(len=2) :: pattern ='IS'

First, the long string is spread over two lines so that one have
to finish the first line with a "&" and start the next one
with another "&" : the full string will then be correctly
computed.

Second, the "index" intrinsic accepts only character(len=<something>)
arguments. Here the first argument had type character, dimension(150),
which is an array of character, not a string.

For string manipulation itself, you may find interesting to
use the "flibs" project :
http://flibs.sourceforge.net/
where you will find several string algorithms which may be useful,
for example "string_match( string, pattern)".

Best regards,

Michaël
.



Relevant Pages

  • Re: Specific names for intrinsic functions and optional arguments
    ... processor/compiler support the requested KIND). ... INDEX (STRING, SUBSTRING ) ... -- SUBSTRING shall be of type character with the same kind type parameter as ...
    (comp.lang.fortran)
  • Re: working with bits
    ... VB supports the standard bitwise operations Or, And, Not and XOr as well as ... One thing to be aware of, there is no type character for byte, so for constants you have to write CByteor similar. ... This requires changing a string of 12 chr's to a stream of 96 bits and then manipulating these. ... Would it be better for me to use another language and build a DLL to do the bit manipulating or does vb.net have some way of working with bits. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: index function problem
    ... relaxmike wrote: ... Here the first argument had type character, dimension, ... which is an array of character, not a string. ...
    (comp.lang.fortran)
  • Re: Fortran 90 Functions and Character Strings
    ... > relatively new to any version of FORTRAN? ... > An essential feature of FORTRAN is that variables of type CHARACTER are ... One can write a function that returns a VARYING length string and in fact I ...
    (comp.lang.fortran)
  • Re: Threading on Functions returning values
    ... People like you are very Important for this forum. ... delegate string MyDelegate; ... the delegate returns a value, so too does the Invoke() method. ...
    (microsoft.public.dotnet.framework)