Dedian  
-- 关注搜索引擎的开发
公告
  • people online

    Banner
    我的Java之外:
    《每点博刻》
日历
<2007年2月>
28293031123
45678910
11121314151617
18192021222324
25262728123
45678910
统计
  • 随笔 - 82
  • 文章 - 2
  • 评论 - 28
  • 引用 - 0

导航

常用链接

留言簿(2)

随笔分类(45)

随笔档案(82)

文章档案(2)

Java Spaces

搜索

  •  

积分与排名

  • 积分 - 28350
  • 排名 - 508

最新评论

阅读排行榜

评论排行榜

 
Got a question, when I apply sort command line in linux to sort some domain names by dictionary order, no matter which option i used, it will sort some domains like this:

...
abca.com
abc-d.com
abce.com
...

I am curious what comparison function it applys in its' sorting function. I supposed it should be a string comparison, like strcmp function, but it is not. coz strcmp will compare ascii code of characters in string one by one, thus above sorting should like this:

abc-d.com
abca.com
abce.com

one guess is that when sorting names the special characters like "." "-" will be skipped. but still got some problem when sorting following names:

abc---d.com
abc--d.com
abc-d.com

why can linux sorting keep this order? if it skips some special characters, above names should be compared equally and maybe sorted as a random order.

confused, anybody has thought about that?

-----
p.s.

Haven't got updated here for quite a long time, coz I am back to program with c under linux and I believe it is a place for Java programmers.

-----

update:

Linux sorting compares unicode of strings … more about unicode is here




posted on 2007-02-02 07:10 Dedian 阅读(371) 评论(0)  编辑  收藏 所属分类: Linux

专题:iPad  jQuery  Chrome OS

博客园首页  IT新闻  闪存  学英语
标题  
姓名  
主页
验证码 *  
内容(请不要发表任何与政治相关的内容)  
  登录      
该文被作者在 2007-02-10 05:59 编辑过
每天10分钟,轻松学英语


网站导航:
 
 
Copyright © Dedian Powered by: 博客园 模板提供:沪江博客