Skip to content

Instantly share code, notes, and snippets.

@AxGord
Last active December 18, 2015 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AxGord/5830045 to your computer and use it in GitHub Desktop.
Save AxGord/5830045 to your computer and use it in GitHub Desktop.
static var keyWords = ['for', 'while', 'if', 'else', 'do', 'class', 'case', 'cast', 'catch', 'continue', 'enum', 'super', 'switch', 'true',
'package', 'in', 'import', 'static', 'function', 'null', 'extends', 'extern', 'false', 'implements', 'inline', 'this', 'throw', 'trace',
'break', 'callback', 'default', 'dynamic', 'interface', 'never', 'new', 'override', 'private', 'public', 'return', 'static',
'try', 'typedef', 'untyped', 'using', 'var'];
static var vSymb = '_abcdefghijklmnopqrstuvwxyz';
static function checkIsValidFieldName(v:String):Bool {
if ( v == '' || Std.parseInt(v.substr(0, 1)) != null) return false;
v = v.toLowerCase();
if ( Lambda.indexOf(keyWords, v) != -1 ) return false;
for (i in 0...v.length) if (vSymb.indexOf(v.substr(i, 1)) == -1 && Std.parseInt(v.substr(i, 1)) == null) return false;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment