Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!clyde!cuae2!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!falk From: falk@uiucuxc.cso.uiuc.edu Newsgroups: comp.lang.fortran Subject: Re: accessing character arrays... Message-ID: <178700001@uiucuxc> Date: Fri, 5-Dec-86 15:03:00 EST Article-I.D.: uiucuxc.178700001 Posted: Fri Dec 5 15:03:00 1986 Date-Received: Sun, 7-Dec-86 20:52:10 EST References: <1772@ncoast.UUCP> Lines: 24 Nf-ID: #R:ncoast.UUCP:1772:uiucuxc:178700001:000:881 Nf-From: uiucuxc.cso.uiuc.edu!falk Dec 5 14:03:00 1986 >/* ---------- "accessing character arrays..." ---------- */ >how do you access characters in arrays of character*n? >I am using Vax Fortran, and would like to access individual characters in >an array of character*n: > character*n a(m) >I want it to be "m lines of n character 'strings'", but fortran won't let >me access character y in "line" x with: > a(x,y), or a(x)(y)... >-- >Brad Banko Look in the Fortran manual under "Substrings, character". You can accomplish what you want with that notation. The following program segment is an example: character*10 temp(5) data temp/'first ','second ','third ', ... / print*(temp(i)(2:4), i=1,5) stop end It will print the 2nd, 3rd and 4th characters in each of the 5 elements of temp. The 2 and 4 can be replaced by variable expressions and you can search the strings until you find an appropriate match.