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 37b662d

Browse files
author
Openset
committed
Update: IsDigit
1 parent 564dee5 commit 37b662d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎problems/reorder-log-files/reorder_log_files.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ func reorderLogFiles(logs []string) []string {
1111
s1 := strings.SplitN(logs[i], " ", 2)
1212
s2 := strings.SplitN(logs[j], " ", 2)
1313
f1, f2 := "0"+s1[1], "0"+s2[1]
14-
if unicode.IsNumber(rune(f1[1])) {
14+
if unicode.IsDigit(rune(f1[1])) {
1515
f1 = "1"
1616
}
17-
if unicode.IsNumber(rune(f2[1])) {
17+
if unicode.IsDigit(rune(f2[1])) {
1818
f2 = "1"
1919
}
2020
return f1 < f2

‎problems/string-to-integer-atoi/string_to_integer_atoi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func myAtoi(str string) int {
1515
str = str[1:]
1616
}
1717
i := strings.IndexFunc(str, func(r rune) bool {
18-
return !unicode.IsNumber(r)
18+
return !unicode.IsDigit(r)
1919
})
2020
if i > -1 {
2121
str = str[0:i]

0 commit comments

Comments
(0)

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