Skip to content

Commit 76210fb

Browse files
committed
Detect Capital
1 parent 54f6cb1 commit 76210fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Source : https://leetcode.com/problems/detect-capital/?tab=Description
2+
// Author : Han Zichi
3+
// Date : 2016-02-27
4+
5+
/**
6+
* @param {string} word
7+
* @return {boolean}
8+
*/
9+
var detectCapitalUse = function(word) {
10+
let p = /^([a-z]+|[A-Z]+|[A-Z]{1}[a-z]+)$/;
11+
return p.test(word);
12+
};

0 commit comments

Comments
 (0)