C#字符串最高 [英] C# highest string

查看:109
本文介绍了C#字符串最高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎很微不足道,但我没有找到与谷歌的答案。

This seems so trivial but I'm not finding an answer with Google.

在年底信号量的字符串高值后,我。字符串的排序列表

I'm after a high value for a string for a semaphore at the end of a sorted list of strings.

在我看来,这char.highest.ToString()应该这样做 - 但这种比较低,不高

It seems to me that char.highest.ToString() should do it--but this compares low, not high.

显然这不是真正可能创造一个最高可能的字符串,因为它总是会比同样的事情下部和更多的数据,但我排序都是有效的路径名,因此,码元的串。使用被限制

Obviously it's not truly possible to create a highest possible string because it would always be lower than the same thing + more data but the strings I'm sorting are all valid pathnames and thus the symbols used are constrained.

在回应评论:

在Delphi中我会预unicode的天简单地使用了#255。我只是想要一个字符串,它会比任何可能的路径比较高。这应该是微不足道的 - 为什么不呢??

In the pre-unicode days in Delphi I would simply have used #255. I simply want a string that will compare higher than any possible pathname. This should be trivial--why isn't it??

回复#2:

这不是排序需要的定点,它的处理之后。我有我排序的合并(一个简单的合并不会做这项工作。),要么我重复的代码或我有总比高虚拟值多个列表。

It's not the sorting that requires the sentinel, it's the processing afterwards. I have multiple lists that I am sort-of merging (a simplistic merge won't do the job.) and either I duplicate code or I have dummy values that always compare high.

推荐答案

最高字符的字符串表示将只有一个字符。

A string representation of the highest character will only be one character long.

你为什么不只是它追作为一个信号量排序,而不是试图使它的东西,将排序后?

Why don't you just append it as a semaphore after sorting, rather than trying to make it something that will sort afterwards?

另外,你可以指定自己的比较其他任何字符串后排序您的令牌后,否则调用默认比较。

Alternatively, you could specify your own comparator that sorts your token after any other string, and calls the default comparator otherwise.

这篇关于C#字符串最高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆