在 TableSorter 中对字符串 'xx,xx€' 进行数字排序

Sort numerically on string 'xx,xx€' in TableSorter

我正在尝试使用表格分类器对我的购物车商品的价格进行分类。结果升序排序:

9,20€   
8,00€   
7,23€   
6,70€   
5,70€   
12,00€  
11,00€  

我的解析器:

ts.addParser({
    id: "currency",
    is: function (s) {
        return /^[£$€?.]/.test(s);
    }, format: function (s) {
        return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), ""));
    }, type: "numeric"
});

如何解决此类问题?

解决方法:

 ts.addParser({
            id: "euroValue",
            is: function(s) {
                //u20AC = €
                return /^\d+,\d+\u20AC$/.test(s);
            },
                format: function(s) {
                //replace comma and €-Symbol
                return jQuery.tablesorter.formatInt( s.replace(/[, \u20AC]/g,'') );
            },
            type: "numeric"
});