Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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)

AltStyle によって変換されたページ (->オリジナル) /