It's sorted lexically by the unicode code points. Why would str1 come
after str2? '1' < '9'.

On Fri, 2019-07-05 at 21:23 -0700, shubham.pendharkar via golang-nuts
wrote:
> It sorts by name, but there is a big problem with golang string
> comparison.
> If you consider these two strings:
> str1 : "hello.20190305-102.txt"
> str2 : "hello.20190305-99.txt"
> 
> Then we should say that str1 > str2.
> But go returns str1 < str2
> 
> On Wednesday, August 19, 2015 at 3:10:41 PM UTC+5:30, Arie van
> Wingerden 
> wrote:
> > 
> > The docs say: ReadDir reads the directory named by dirname and
> > returns a 
> > list of sorted directory entries.
> > *It does not say sorted by what. *
> > Maybe a doc update would be nice.
> > TIA
> > 
> > 
> 
> -- 
> This message contains confidential information and is intended only
> for the 
> individual to whom it is addressed. If you are not the intended
> recipient, 
> you should not disseminate, distribute or copy this e-mail. Please
> notify 
> the sender immediately by e-mail if you have received this e-mail by 
> mistake and permanently delete this e-mail from your system. E-mail 
> transmission cannot be guaranteed to be secure or error-free as
> information 
> could be intercepted, corrupted, lost, destroyed, late or incomplete,
> or 
> could contain viruses. The sender therefore does not accept liability
> for 
> any errors or omissions in the contents of this message, which arise
> as a 
> result of e-mail transmission. If verification is required, please
> request 
> a hard-copy version from the sender. Druva, www.druva.com 
> <http://www.druva.com/>
> 
> -- 
> 
> 
> This message contains confidential information and is intended only
> for 
> the individual to whom it is addressed. If you are not the intended 
> recipient, you should not disseminate, distribute or copy this e-
> mail. 
> Please notify the sender immediately by e-mail if you have received
> this 
> e-mail by mistake and permanently delete this e-mail from your
> system. 
> E-mail transmission cannot be guaranteed to be secure or error-free
> as 
> information could be intercepted, corrupted, lost, destroyed, late
> or 
> incomplete, or could contain viruses. The sender therefore does not
> accept 
> liability for any errors or omissions in the contents of this
> message, 
> which arise as a result of e-mail transmission. If verification is 
> required, please request a hard-copy version from the sender. Druva, 
> www.druva.com <http://www.druva.com/>
> 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b5cb1e05924f6614eaca3eb280acd0aae44b631c.camel%40kortschak.io.
For more options, visit https://groups.google.com/d/optout.

Reply via email to