我有串的名单,这是最有可能的,但不能保证包含数字组成的列表,即
I have a list of string, which is most likely, but not guaranteed to contain a list of numerics, i.e.,
{"1", "6", "2", "21", "89"}什么是排序的字符串列表,以便它总是会出现按升序排列的方式?
What is the way to sort the string list so that it will always appear in ascending order?
我无法解析字符串做简单排序前第一个数字因为字符串的可以包含非数字字符。我不想去通过列表并检查铸每个组件数字和进行排序。是否有已经存在在那里用于此目的的图书馆吗?
I can't parse the string to numeric first before doing the sorting simply because the string can contain non numeric characters. And I don't want to go through the list and check-cast each component to numerics and do the sorting. Is there already a library existing out there for this purpose?
在我们拥有混合数字和非数字的字符串项,数字串始终优先的情况下在非数字的。
推荐答案这已经问略有不同,但相同的答案仍然适用,
This has been asked before slightly differently, but the same answer still applies, as they have a C# implementation on the same site.
SO问题一个字符串 - 即,可能-包含一个数字>排序上的绳子可能包含一些通过在
SO Question: Sort on a string that may contain a number
答= stackoverflow/users/1310/scarcher2\">ScArcher2 :的Alphanum算法
Answer provided by ScArcher2: The Alphanum Algorithm
更多推荐
带数值排序字符串列表
发布评论