如何在不使用正则表达式的情况下从txt文件中删除 \ t?

如何在不使用正则表达式的情况下从txt文件中删除
 \ t?

问题描述:

Input: The input is read from a text file: while ($data = FGets($soubor)) { ... }.

Output: I would like to safe content to DB (import) without \t.

I think, that it offers an alternative for trim:

while () ...
$editedText = trim($data, "\t");

I need \t, and check in whole txt document. Any suggestions and samples?

What is the best way for this easy task without RE?

输入 strong>:从文本文件中读取输入: while($ data = FGets($ soubor)){...} code>。 p>

输出 strong>:我想安全内容到DB(导入)而不用 \ t code>。 p>

我认为,它为trim提供了另一种选择: p>

  while(  )... 
 $ editedText = trim($ data,“\ t”); 
  code>  pre> 
 
 

我需要\ t, 并检入 整个 strong> txt文档。 任何建议和样本? p>

没有RE strong>这项简单任务的最佳方法是什么? p> div>

The str_replace() function is your new best friend.


$editedText = str_replace(array("\t", "
"), "", $data);

I use

 s.trim();

it helps to lose whiteSpace, , \t and so on from both ends of the string.