using System;
using System.Collections .Generic ;
using System.Linq ;
public class Test
{
public static void Main( )
{
List< string> bunchOfStrings = new List< string> ( ) ;
bunchOfStrings.Add ( "This should not be at the top" ) ;
bunchOfStrings.Add ( "This should not be at the top either" ) ;
bunchOfStrings.Add ( "This should also not be at the top" ) ;
bunchOfStrings.Add ( "This *SHOULD be at the top" ) ;
bunchOfStrings.Add ( "This should not be at the top" ) ;
bunchOfStrings.Add ( "This should be *somewhere close to the top" ) ;
foreach ( var str in bunchOfStrings.OrderBy ( x => {
var index = x.IndexOf ( "*" ) ;
return index < 0 ? 9999 : index;
} ) )
{
Console.WriteLine ( str) ;
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkxpbnE7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7CgkJTGlzdDxzdHJpbmc+IGJ1bmNoT2ZTdHJpbmdzID0gbmV3IExpc3Q8c3RyaW5nPigpOwoJCWJ1bmNoT2ZTdHJpbmdzLkFkZCgiVGhpcyBzaG91bGQgbm90IGJlIGF0IHRoZSB0b3AiKTsKCQlidW5jaE9mU3RyaW5ncy5BZGQoIlRoaXMgc2hvdWxkIG5vdCBiZSBhdCB0aGUgdG9wIGVpdGhlciIpOwoJCWJ1bmNoT2ZTdHJpbmdzLkFkZCgiVGhpcyBzaG91bGQgYWxzbyBub3QgYmUgYXQgdGhlIHRvcCIpOwoJCWJ1bmNoT2ZTdHJpbmdzLkFkZCgiVGhpcyAqU0hPVUxEIGJlIGF0IHRoZSB0b3AiKTsKCQlidW5jaE9mU3RyaW5ncy5BZGQoIlRoaXMgc2hvdWxkIG5vdCBiZSBhdCB0aGUgdG9wIik7CgkJYnVuY2hPZlN0cmluZ3MuQWRkKCJUaGlzIHNob3VsZCBiZSAqc29tZXdoZXJlIGNsb3NlIHRvIHRoZSB0b3AiKTsKCQ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