I have a row of text. In this row there are subtitles containing a space and each subtitle is tab separated from another subtitle. I've roughly coded this (below) as an example and it is getting mixed up when the subtitle width including the space is about 8 which I think is the default tab. There is probably a much better way of doing this but I can't see it. Example... title space 1 tab titleabcd space 2 tab next title and so on. I'm copying a row from Excel into a text file and it is tab separated with 1 or 2 spaces in each cell. A bit puzzled at present. The subtitle can be anywhere between 1 and 20 with a couple of spaces. Any help welcomed.
IMPLICIT NONE
INCLUDE <Windows.ins> , nolist
INTEGER i, j, jj
INTEGER (KIND=2) kk
CHARACTER*1000 numstr
CHARACTER*20 title(50)
numstr = 'titleab 1 titleabc 2 titleabcd 3 titleabcde 4
& titleabcdef 5 titleabcdefg 6 titleabcdefgh 7
& titleabcdefghi 8 titleabcdefghij 9'
CALL compress@(numstr,kk)
CALL trim@(numstr)
do i = 1, 50
CALL trim@(numstr)
jj = leng(numstr)
j = index(numstr(1:jj),CHAR(9))
if (j .ne. 0) then
title(i) = numstr(1:j-1)
print *, title(i)
numstr = numstr(j+1:jj)
endif
enddo
end