在制表符分割线 [英] Split line at the tab character

查看:185
本文介绍了在制表符分割线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在标签处分割一行,并将逗号看作字符。我尝试使用包含\ t或的 pos 变量来追踪这种解决方案,但它返回0,所以它找不到任何标签。

I would like to split a line at tab and read commas as character. I tried to follow a solution of this kind, using a pos variable containing "\t" or " ", but it returns me 0, so it doesn't find any tab. Which could be the right solution?

INTEGER :: i, dots, commas, A, T, C, G, InDel, M, Z, L, s, sf, numsize, InDelSlide, pos, base, cov
CHARACTER(len=1) :: ref
CHARACTER(len=10000) :: arg, seq, qual
CHARACTER(len=1024) :: buffer
CHARACTER(len=6) :: num
CHARACTER(len=5) chr

READ(5,'(A)') buffer
PRINT *, buffer
pos = INDEX(buffer, "   ")
arg = buffer(1:pos-1)
READ(buffer(pos+1:), *) chr, base, ref, cov, seq, qual


推荐答案

Fotran中的Tab字符只是 achar(9)。使用

Tab character in Fotran is simply achar(9). Use

pos = INDEX(buffer, achar(9))

achar()函数返回一个带有传递给它的ASCII值的字符。

The achar() function returns a character with the ASCII value you pass to it.

这篇关于在制表符分割线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆