dongzou7134 2017-10-24 20:12
浏览 24

换行的其他特殊字符? [关闭]

I'm able to get rid of all , , , , PHP_EOL, and \t pieces from a string. I've also found (I think) most of the whitespace-related special characters: 	, 
, 
,  ,  , and for kicks ¶ and ¶ which should mean the same thing, but I was running out of things to try.

However, when I process the string, there's still a newline from time to time. There doesn't seem to be a trend. Is there a special character or something else missing from this list that would leave a newline in a textarea?

Newlines before and after the ones left are removed, and the script's thorough on the first round by ensuring it never breaks out of its loop until there aren't any changes. As a guarantee-test, I tried str_replace on all of the above and it didn't change anything.

When I copy and paste the string into a doc with hidden characters enabled, it displays a paragraph symbol in those places, but copying/pasting that character into the script as a replacement didn't work, either.

So, what's missing?

Edited to add 
 and 

Edit: The problem with adding code is that it's spread out and based on an array that gets cycled through. The below is a straightforward bit that (Now) removes 'all' instances in a string. It looks like adding 
 and 
 fixes it in the 'replace all,' but didn't in my circumstance-driven script, so I'll have to figure that one out. At least I know what I was missing now. :)

$this->keys = array("
", "
", "", "
", PHP_EOL);
str_ireplace($this->keys, "", $this->formatted);
str_ireplace(array("\t", "	", " ", " ", "¶", "¶", "
", "
"), "", $this->decodeHTML($this->formatted));
  • 写回答

2条回答 默认 最新

  • dsyk33753 2017-10-24 20:15
    关注

    chr(10) [linefeed] and chr(13) [carriage return] are not on your list.

    And, of course, if you are outputting to html, <br> and <br/>.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c