odata - how to check variable type is GUID or not in jquery? -
i have database type guid , value of column "33c3ccbc-b6bb-4caa-ab10-338aa95f366e".
in jquery type of guid column showing string, need perform operation in odata. how check if variable type guid or not in jquery.
there no such thing guid in javascript. need string manipulation determine if given string valid guid. using regular expression seems ideal task.
this regular expression match guid:
/[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}/i
this method test if given string valid guid (not tested, written top of head)
function isguid(value) { var regex = /[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}/i; var match = regex.exec(value); return match != null; }
Comments
Post a Comment