我有一个包含许多行的纯文本文件.每行包含5个单词.例如:
cat bat rat mat sat
hello hi howdy namaste salaam
here there where nowhere somewhere
a b c d e
......
......
Run Code Online (Sandbox Code Playgroud)
现在我正在使用fgets()函数逐个检索这些行.线条被完美地检索,但是当我explode在字符串中形成5个单词的数组时,我看到尾随line feed字符也包含在数组中.
那么如何line feed在爆炸时删除尾随字符?