Skip to content

Instantly share code, notes, and snippets.

@pragdave
Created January 27, 2020 00:34
Show Gist options
  • Save pragdave/4c34bca2361fc3755979dd238bb77cc0 to your computer and use it in GitHub Desktop.
Save pragdave/4c34bca2361fc3755979dd238bb77cc0 to your computer and use it in GitHub Desktop.
// swap the clauses in the following sentence
// the result will be "the world is your oyster, if you can program"
str1 = "if you can program, the world is your oyster"
// replace three or more trailing identical digits in a number wih just one
// digit and three dots, so 0.456666 becomes 0.456... and 124.3333 becomes
// 124.3... Numbers such as 124.33 and 124.35553 are left unchanged
str2a = "0.456666"
str2b = "124.3333"
str2c = "124.33"
str2d = "124.3553"
str3 = `
a favorite of puzzle books: what's wrong with this phrase?
Paris in the
the spring
Can you write a regular expression to find any occurances of
of duplicated words in a string?`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment