c# 4.0 - Linq OrderBy but ignore first word if "the" -


I have the following Linux expression to place an order, but I was wondering how to change it so that it Name, but ignore the first word if it is "the"

  case studio. Orderbie (a => a.Name)    

simple way (if there is more than one position between always short-case and words):

  case studio Programmed. Orterby (A => A.Names Started ("The")? A .name.Substring (4): a.Name)   

You can make the method with good Check descriptive names and this argument as well as tap and compare here:

  Private string RemoveDefiniteArticle (string) {if (String.IsNullOrEmpty (s)); If (S. Start ("The", String Compression, Content Ignore Case) Returns. Asbestring (4). TrimStart (); Return s; }   

and use it

  CaseStudies.OrderBy (a => RemoveDefiniteArticle (a.Name))    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -