开发者

Sorting a string with special characters like this N/S,N/A

I need to sort a collection of开发者_Go百科 strings, some of which contain special characters, in JavaScript.

Here is some examples to sort

N/S
N/A 
dd/mm/yy (Date format)

like in which these Strings are containing a special character '/'.

For now I'm using sort method on array which is not fixing the issue as expected.


The examples you provide aren't helpful as you don't provide the sorting rules that go with them.

The sort method accepts (as an argument) a function which describes the sorting rules. Express your rules in that function. There are some examples of how to write this function in the documentation for sort on MDN

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜