利用函数index:
INDEX(STRING,SUBSTRING,BACK)
purpose: return the starting position of a substring within a string
When BACK missing or BACK=.False. , return the first starting postion of substring, if no substring in string or LEN(string)<LEN(substring), return 0, if LEN(substring)=0, return 1 ;
When BACK=.True., return the last starting position of substring. The return value is similar as .False. case.
EXAMPLE: 文本文件
xyz x 1 y 2 z 3
分割提取字符和数字
1 program main 2 implicit none 3 character(len=100) :: str