Created
June 14, 2011 20:01
-
-
Save psyked/1025740 to your computer and use it in GitHub Desktop.
Format FQL in ActionScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatFQL(input:String):String | |
{ | |
var output:String = ""; | |
var indent:String = ""; | |
var queries:Array = input.split("SELECT"); | |
for (var i:int = 1; i < queries.length; i++) { | |
indent += " "; | |
output += "SELECT" + queries[i].split("FROM").join("\n" + indent + "FROM").split("WHERE").join("\n" + indent + "WHERE").split("IN").join("\n" + indent + "IN").split("ORDER").join("\n" + indent + "ORDER"); | |
indent += " "; | |
output += "\n" + indent; | |
} | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment