Linux 使用什么字符将项目放在字母列表的末尾?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8086375/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 07:08:12  来源:igfitidea点击:

What character to use to put an item at the end of an alphabetic list?

windowslinuxfilesystemsalphabetical-sort

提问by Kraz

I often prepend '_' to the item I want in first position.
Is there some sort of magical character I could use to put an item at the end of the list?

我经常在我想要的第一个位置前面加上“ _”。
是否有某种神奇的字符可以用来将一个项目放在列表的末尾?

Something more elegantthan "z_item".

比“z_item”更优雅的东西。

From

  • _custom folder1
  • _custom folder2
  • Inbox
  • Sent box
  • Spam folder
  • _自定义文件夹1
  • _自定义文件夹2
  • 收件箱
  • 发送箱
  • 垃圾邮件文件夹

To

  • Inbox
  • Sent box
  • Spam folder
  • [?]custom folder1
  • [?]custom folder2
  • 收件箱
  • 发送箱
  • 垃圾邮件文件夹
  • [?]自定义文件夹1
  • [?]自定义文件夹2

Yeah, it's COT-ish.

是的,它是 COT 风格的。

采纳答案by Doug

The Special lead-in Character that will put your folder at the end of the list without having to resort to using the "z" combo: U+E83A: Private Use. In fact, I believe any of the Private Use characters will work. (u) Just copy and paste the character between the brackets.

将您的文件夹放在列表末尾的特殊导入字符,而无需使用“z”组合:U+E83A:私人使用。事实上,我相信任何私人使用角色都可以使用。(u) 只需复制并粘贴括号之间的字符即可。

回答by KarlP

Using cp1252 and unless you're using the letters ? ù ú ? ü y t ? alot, ÷ seems to be an option...

使用 cp1252 并且除非您使用字母 ? u ? 你是吗?很多,÷ 似乎是一个选项......

Edit: Using unicode, ? (\uffed) might also be a possibility, unless you are writing a lot in Linear-B...

编辑:使用 unicode,?(\uffed) 也可能是一种可能性,除非你用 Linear-B 写了很多......

回答by Peter II

I've found two characters that will put your folders at the bottom of the list. The first is "ι" and its variant "Ι". Also, the two best characters to put your folders at the front of the pack are either the No-break space "?" and the bullet "·"

我找到了两个可以将您的文件夹放在列表底部的字符。第一个是“ι”及其变体“I”。此外,将文件夹放在包前面的两个最佳字符是不间断空格“?” 和子弹“·”

For the novice user (like me) who might have found this question and these answers by accident, here's a simple explanation of how to type these characters. The first is literally a space created by holding the "Alt" key & typing "0160" on your number pad and the second is the "Alt & 250" combination ?(Note: A 10-key number pad is best. If you don't have one on your keyboard, see if you can figure out how to use the alternate number keypad. This is almost always different than the 1-0 keys at the top of your keyboard. Look for tiny numbers printed on the edges of your keyboard -usually the "M" "J" L" "I" "O" "P" & 7-0 keys). Or, of course, you can copy and paste the characters in the quotations above (not as easy if you frequently use them as I do).

对于可能偶然发现这个问题和这些答案的新手用户(像我一样),这里有一个关于如何输入这些字符的简单说明。第一个实际上是通过按住“Alt”键并在数字键盘上键入“0160”而创建的空间,第二个是“Alt & 250”组合?(注意:最好使用 10 键数字键盘。如果您不这样做如果您的键盘上没有,看看您是否能弄清楚如何使用备用数字键盘。这几乎总是与键盘顶部的 1-0 键不同。寻找印在您键盘边缘的小数字键盘——通常是“M”、“J”、“L”、“I”、“O”、“P”和 7-0 键)。或者,当然,

Here's a short list of special characters to both prioritize your folders or have them appear at the end of a folder list as well as some other folder-friendly characters. Enjoy (~Peter II)

这是一个特殊字符的简短列表,可用于确定文件夹的优先级或让它们出现在文件夹列表的末尾以及其他一些文件夹友好的字符。享受(~彼得二世)

Useful Characters for Windows Explorer

Windows 资源管理器的有用字符

?????0160????????????No-Break Space

??????0160????????????无间断空间

·????249/0183????Middle Dot

·????249/0183????中间点

·????250/8729??? Bullet operator

·????250/8729??? 子弹操作员

?????9702???????????White bullet

?????9702?????????????白色子弹

?????0155/8250???(See Above)

??????0155/8250???(见上)

∕????8275????????????Division slash

∕????8275????????????司斜线

ι???????????????????????(End Character)

ι????????????????????????????(结束字符)

Ι??????????????????????(End Character)

我???????????????????????????(结束字符)

???2713?????????Check Mark

???2713?????????复选标记

?????Last but not least, this alt key (1475) is Hebrew Punctuation Sof Pasuq -This is a great character to use when you can be used in place of a colon)

回答by sebetovsky

I use:
_ (underscore) to sort before the alphabet and
- (hyphen) to sort after the alphabet.

我使用:
_(下划线)在字母表之前排序,
-(连字符)在字母表之后排序。

(Works with czech sorting in Windows explorer and Total commander.)

(适用于 Windows 资源管理器和 Total Commander 中的捷克语排序。)



edit: Windows 7 and later sort the hyphen - as if the hyphen wasn't there.

编辑:Windows 7 及更高版本对连字符进行排序 - 好像连字符不存在一样。

回答by cevune

Despite being years later I wanted to contribute as none of the previously provided answers worked for me. For reference I'm running win7 ultimate SP1.

尽管几年后我想贡献,因为以前提供的答案都不适合我。作为参考,我正在运行 win7 Ultimate SP1。

The solution I landed on resulted from noticing that any files I made for use with Japanese speaking contacts ended at the end of the file list. Apparently Japanese characters don't count as non-alphanumeric similar to hashmark, hyphen, underscore (which place files at the beginning of the list), but also come after English characters.

我找到的解决方案是因为我注意到我为讲日语的联系人制作的任何文件都在文件列表的末尾结束。显然,日文字符不算作类似于井号、连字符、下划线(将文件放在列表开头)的非字母数字,但也算在英文字符之后。

For my own use I ended up using the 末 character, which roughly means "end" so it makes sense to Japanese readers and is still different enough from English to not become confusing.

对于我自己的使用,我最终使用了 end 字符,大致意思是“结束”,所以它对日本读者来说很有意义,并且仍然与英语有足够的不同,不会让人感到困惑。

Alternatively I would use 口 or 一 for something more stylistically apparent. It's also worth noting that the shorthand "maru" character ○ does not work and sorts along with other non-alphabet characters at the head of the list.

或者,我会使用口或一来表达更明显的风格。还值得注意的是,速记“maru”字符 ○ 不起作用,并与列表开头的其他非字母字符一起排序。

回答by Tristan

I found this thread while wanting folders that sort after Z in Finder on Mac OSX. After several false paths and trial and error, here's what I found:

我在 Mac OSX 上的 Finder 中想要在 Z 之后排序的文件夹时发现了这个线程。经过几个错误的路径和反复试验,这是我发现的:

Characters that sort after Z in Finder (in sort-order)

Finder 中 Z 之后排序的字符(按排序顺序)

  • z Lower case Z
  • ι Greek letter
  • Ι Greek letter, capital version of above character, not an "I")
  • Ω Omega
  • 一 Japanese Character? (Thanks, Jam)
  • 口 Japanese character? (Thanks, Jam)
  • 末 Japanese character "End" (Thanks, Jam)
  • u (a private use character) (Thanks, Peter O.)
  • z 小写 Z
  • ι 希腊字母
  • Ι 希腊字母,上述字符的大写版本,不是“I”)
  • 欧米茄
  • 一个日本字符?(谢谢,果酱)
  • 口日文?(谢谢,果酱)
  • 末日日语字符“结束”(谢谢,果酱)
  • u(私人使用字符)(谢谢,Peter O.)

These are characters others here and in other places on the web, mentioned sort after Z, but that I found DO NOT sort at the end, at least when sorting by name in Finder on Mac:

这些是这里和网络上其他地方的其他字符,提到在 Z 之后排序,但我发现最后不要排序,至少在 Mac 上的 Finder 中按名称排序时:

? ? ~ - ? [ ? ? |

? ? ~ - ? [ ? ? |

回答by Steven Penny

Based on code page 437, here is a list of characters that come after z. Note they are listed in sort order. Omega is probably the most appropriate for this use case, because it is the last letter of the Greek alphabet.

基于代码页 437,这里是 z 之后的字符列表。请注意,它们是按排序顺序列出的。Omega 可能最适合这个用例,因为它是希腊字母表的最后一个字母。

α  alpha        U+03B1  Alt 224
Γ  gamma        U+0393  Alt 226
δ  delta        U+03B4  Alt 235
ε  epsilon      U+03B5  Alt 238
Θ  theta        U+0398  Alt 233
π  pi           U+03C0  Alt 227
Σ  sigma upper  U+03A3  Alt 228
σ  sigma lower  U+03C3  Alt 229
τ  tau          U+03C4  Alt 231
Φ  phi upper    U+03A6  Alt 232
φ  phi lower    U+03C6  Alt 237
Ω  omega        U+03A9  Alt 234

回答by Mike Mounier

Those that find that most of the codes given here produce different characters than what is described, you probably have ?EnableHexNumpad???enabled in? HKCU?\?Control Panel?\?Input Method... this is by and large a? good?thing, but you do have to convert the codes to hex and precede them with '+' sign (on the num keypad), eg. for the colon at Alt+1475, use the hex equivalent of Alt+5C3 (?hit? Alt??with the left hand and hold it down, then with the right hand hit the keypad? +??… then? 5??, C??, and? 3??… then let go of? Alt???).

那些发现此处给出的大多数代码产生的字符与所描述的字符不同的人,您可能有 ? EnableHexNumpad???启用?HKCU?\?控制面板?\?输入法...这基本上是一个?东西,但是您必须将代码转换为十六进制并在它们前面加上“+”符号(在 num 键盘上),例如。对于 Alt+1475 处的冒号,使用等效于 Alt+5C3 的十六进制(?hit?Alt?? 用左手按住它,然后用右手敲击键盘?+??...然后?5?? , C??, and? 3??... 然后放开? Alt??)。

And, speaking of colons, there's another (smaller) good colon at Alt+1361 hex, which would be Alt+4961 without HexNumpad if?it works that way.

并且,说到冒号,在 Alt+1361 十六进制处还有另一个(较小的)好的冒号,如果它以这种方式工作,那就是Alt+4961 没有 HexNumpad 。

回答by G M

Don't mess up things using strange characters!

不要用奇怪的字符搞砸事情!

I would not suggest using Private Use charactersor non-printable characters because they can really mess up the things when you access your folder from terminal or programming languages. I had annoying issues using 末 or other special characters. For example, using Python 2.7, this is how you will see your folders with the non-printable characters Ω, 末, 口,u.

我不建议使用私人使用字符或不可打印的字符,因为当您从终端或编程语言访问文件夹时,它们真的会把事情搞砸。我在使用 END 或其他特殊字符时遇到了烦人的问题。例如,使用 Python 2.7,您将看到带有不可打印字符 Ω、末、口、u 的文件夹。

os.listdir(os.getcwd())
Out[2]: ['\xe6\x9c\xab ', '\xe5\x8f\xa3 ', '\xce\xa9 ', '\xee\xa0\xba ']

For someone or something using your folder structure, accessing the folder would be very confusing (and you can see it from the comments like thisto the top answer).

某人或某事使用您的文件夹结构,访问该文件夹将是非常混乱的(你可以看到它从注释中像这样顶端的答案)。

So I created a folder with this at the beginning of the name on my Sharepoint drive and now it's there and I can't access it or delete it. :| – Rather Notsay Jun 28 '16 at 21:05

所以我在我的 Sharepoint 驱动器上的名称开头创建了一个文件夹,现在它就在那里,我无法访问它或删除它。:| – 而不是 Notsay 16 年 6 月 28 日,21:05

Of course, you can print them, but why make the things so unnecessarily complex? If you want to stay on the safe side, I would suggest using standard characters. Which is the last one depends on your File manager. So here is some code that creates a bunch of folders with all the printables strings in Python so you can test your file manager.

当然,你可以打印它们,但为什么要把事情搞得这么复杂呢?如果您想保持安全,我建议您使用标准字符。最后一个取决于您的文件管理器。所以这里有一些代码,它在 Python 中创建一堆包含所有可打印字符串的文件夹,以便您可以测试您的文件管理器。

import os
import string
for i in string.printable:
      try:
            os.mkdir(i)
      except OSError:
            print('OSError for %s' %(I))

Once you have sorted by name you can get your answer.

按名称排序后,您就可以得到答案。

For Windows 10 - Explorer

对于 Windows 10 - 资源管理器

using standard characters after zup to my knowledge there is only zzand so on. enter image description here

z我所知,使用标准字符后只有zz等等。 在此处输入图片说明

So using zzNameOfTheFolderis an easy and safe way to do to that. So even if it's not nice I would recommend it.

因此,使用 zzNameOfTheFolder是一种简单而安全的方法。所以即使它不好,我也会推荐它。

For Mac OS X El Capitan - Finder

对于 Mac OS X El Capitan - Finder

enter image description here

在此处输入图片说明

The z is the last character but note that there is no distinction between capital letters so a folder named zzcan't be stored in the same directory of a folder ZZ

z 是最后一个字符,但请注意大写字母之间没有区别,因此命名的文件夹zz不能存储在文件夹的同一目录中ZZ

For Ubuntu 16.04 - Nautilus

对于 Ubuntu 16.04 - Nautilus

enter image description here

在此处输入图片说明

The hashtag #is the last character. But if you want some more compatibility with other file managers I would use ZZ.

主题标签#是最后一个字符。但是如果你想与其他文件管理器有更多的兼容性,我会使用ZZ.

Something more elegant than "z_item"?

比“z_item”更优雅的东西?

I guess this depends on your own concept of elegance and I think StackOverflow should diffuse best and safest practices, not the most elegant. However, in many cases, symmetry can help. What about these safe perhaps more elegant solutions:

我想这取决于你自己对优雅的概念,我认为 StackOverflow 应该传播最佳和最安全的实践,而不是最优雅的。但是,在许多情况下,对称性会有所帮助。这些安全也许更优雅的解决方案怎么样:

ZZFoldernameZZ
Zz-Folder name-zZ
zZ-Folder name-Zz
zZFolderNameZz
zzFoldernamezz

回答by Eric Schrepel

For web and SQL purposes, pre-pending CHAR(127) forces text to the bottom and adds no visible character. Works at least for our use of SQL and the jQuery datatables plugin.

对于 Web 和 SQL 目的,前置 CHAR(127) 强制文本到底部并且不添加任何可见字符。至少适用于我们使用 SQL 和 jQuery 数据表插件。