Skip to content

Instantly share code, notes, and snippets.

View sanjitk7's full-sized avatar
🛠️
Building. Learning.

Sanjit Kumar sanjitk7

🛠️
Building. Learning.
View GitHub Profile
@sanjitk7
sanjitk7 / abbreviation_generator.py
Created May 17, 2020 06:10
Function to Check if String is in camelCase
#check if the word is in camel case
#ip: "helloWorld"
#op: True
def isCamelCase(word):
#check for whitespaces
res = bool(re.search(r"\s", word))
if (not res):
x = re.search(r"^[a-z](.+?)([A-Z])",word)
if (x):
return True
print("hello world!")
@sanjitk7
sanjitk7 / testAbbr.py
Last active May 16, 2020 17:53
split camel case
def test_camelCaseSplit(self):
self.assertEqual(camelCaseSplit("theDarkKnightRises"),["the","Dark","Knight","Rises"])
self.assertEqual(camelCaseSplit("helloW"),["hello","W"])
self.assertEqual(camelCaseSplit("helloIWorld"),["hello","I","World"])
with self.assertRaises(TypeError):
camelCaseSplit(1234)