Skip to content

Instantly share code, notes, and snippets.

@adityatyagi
Last active April 2, 2020 09:11
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 adityatyagi/321803c238b08c0c7e03352d58737fd8 to your computer and use it in GitHub Desktop.
Save adityatyagi/321803c238b08c0c7e03352d58737fd8 to your computer and use it in GitHub Desktop.
var a = "{37a00dcf-fc8a-48c0-b912-ab8c00fcd78e}";
function getContentFromStringWithBraces(stringWithBraces){
let contentWithinBraces = stringWithBraces.substring(stringWithBraces.lastIndexOf("{") + 1, stringWithBraces.lastIndexOf("}"));
return contentWithinBraces;
}
// label to print the time against
console.time('sampleLabel');
console.log(getContentFromStringWithBraces(a));
// exactly same labe
console.timeEnd('sampleLabel');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment