如何使用 jquery tablesorter 对标点符号进行排序?
我有一列包含地址“第 2 行”类型值。此列可以包含 #431、UNIT 203 和 APT 等值。 C,当然它也可以包含空白(或空字符串)值。我需要回答两个问题:
- 您希望如何对这样的混合值进行排序(即升序时顶部的空白或井号)?
- 我如何使用自定义解析器来完成这个任务?
目前使用默认解析器(我假设是字符串解析器),它按升序对井号、空格和 az 值进行排序。我认为它会是空白,井号,然后是 az 值。
I have a column that contains address "line 2" type values. this column can contain values like #431, UNIT 203, and APT. C and of course it can contain blank (or empty string) values also. i need an answer to two questions:
- How would you expect a mixed values like this to be sorted (i.e. blank or pound signs on top when ascending)?
- How would i pull this off with a custom parser?
currently with the default parser (i'm assuming the string parser), it is ordering the values pound signs, blanks, and then a-z values when in ascending order. i would think that it would blanks, pound signs, and then a-z values.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要回答#1,我的期望是这些值将按以下顺序出现:
如果字符串中存在数字,则可以通过修剪除数字之外的所有值来实现此目的,并且仅删除一些已知的前缀并修剪(如果不存在) t 一个数字。无论你做什么都不会是完美的,这是你必须接受/解释的事情。
To answer #1, my expectation would be that those values would appear in this order:
You can probably do this by trimming all but the number away if a number exists in the string, and just removing some known prefixes and trimming if there isn't a number. Whatever you do won't be perfect, and that's something you'll just have to accept/explain.