问题标签 [supplementary]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
108 浏览

java - 如何替换所有非补充字符,但保留所有补充字符?

我对在补充字符上应用的 Java 正则表达式有疑问

我期待着x == z。我究竟做错了什么?jdk1.8.0_144

0 投票
1 回答
507 浏览

swift - Update CollectionView supplementaryView header when off screen

I have a view similar to Instagram's main stories feed. I have a horizontal collection view at the top where I have a supplementaryView header cell that looks the same but acts differently to the rest of the cells.

I am trying to update the objects in the supplementaryView which I have managed to do with the following code...

This works fine when the cell is in view, however when the cell is swiped off screen during this call it doesn't get updated.

Any ideas on how to get around this? Or a better approach to updating just the first cell in a collection view and not the rest.

Thanks

0 投票
2 回答
85 浏览

java - Java RegEx 匹配器会破坏 BMP 之外的字符

我目前正在编写一个 util 类来清理输入,并将其保存到 xml 文档中。对我们来说,清理意味着,所有非法字符 ( https://en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.0 ) 都会从字符串中删除。

我试图通过使用一些正则表达式来做到这一点,它用空字符串替换所有无效字符,但是对于 BMP 之外的 unicode 字符,这似乎以某种方式破坏了编码,让我留下了这些?字符。我使用正则表达式替换的哪种方式似乎也无关紧要 ( String#replaceAll(String, String), Pattern#compile(String), org.apache.commons.lang3.RegExUtil#removeAll(String, String))

这是一个带有测试(在 Spock 中)的示例实现,它显示了问题:XmlStringUtil.java

XmlStringUtilSpec.groovy

我现在有一个解决方案,我从单个代码点重建整个字符串,但这似乎不是正确的解决方案。

提前致谢!