SQL Listing all column names alphabetically

This generates a query with all columns ordered alphabetically in the select statement. DECLARE @QUERY VARCHAR(2000) DECLARE @TABLENAME VARCHAR(50) = ‘<YOU_TABLE>’ SET @QUERY = ‘SELECT ‘ SELECT @QUERY = @QUERY + Column_name + ‘, ‘ FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = @TABLENAME ORDER BY Column_name SET @QUERY = LEFT(@QUERY, LEN(@QUERY) – 4) + ‘ FROM ‘+ … Read more

Simple way to sort strings in the (case sensitive) alphabetical order

If you don’t want to add a dependency on Guava (per Michael’s answer) then this comparator is equivalent: private static Comparator<String> ALPHABETICAL_ORDER = new Comparator<String>() { public int compare(String str1, String str2) { int res = String.CASE_INSENSITIVE_ORDER.compare(str1, str2); if (res == 0) { res = str1.compareTo(str2); } return res; } }; Collections.sort(list, ALPHABETICAL_ORDER); And I … Read more

How to create an alphabetical scrollbar displaying all the letter in android?

This is an iPhone feature, Android uses fast scroll. I’d recommend that you use the platform alternative rather than try to enforce common functionality. If you must, you’ll have to implement this yourself. Put your list view in a RelativeLayout and put A-Z TextViews in a vertical LinearLayout that is set to layout_alignParentRight=”true”. Set the … Read more

How do I sort strings alphabetically while accounting for value when a string is numeric?

Pass a custom comparer into OrderBy. Enumerable.OrderBy will let you specify any comparer you like. This is one way to do that: void Main() { string[] things = new string[] { “paul”, “bob”, “lauren”, “007”, “90”, “101”}; foreach (var thing in things.OrderBy(x => x, new SemiNumericComparer())) { Console.WriteLine(thing); } } public class SemiNumericComparer: IComparer<string> { … Read more

What is a method that can be used to increment letters?

Simple, direct solution function nextChar(c) { return String.fromCharCode(c.charCodeAt(0) + 1); } nextChar(‘a’); As others have noted, the drawback is it may not handle cases like the letter ‘z’ as expected. But it depends on what you want out of it. The solution above will return ‘{‘ for the character after ‘z’, and this is the … Read more