File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2024-2026 Apple Inc. and the Swift.org project authors
6+ // Licensed under Apache License v2.0
7+ //
8+ // See LICENSE.txt for license information
9+ // See CONTRIBUTORS.txt for the list of Swift.org project authors
10+ //
11+ // SPDX-License-Identifier: Apache-2.0
12+ //
13+ //===----------------------------------------------------------------------===//
14+
15+ extension String {
16+ /// Returns whether the string is of the format `isX` (Java Beans boolean
17+ /// property naming convention)
18+ package var hasJavaBooleanNamingConvention : Bool {
19+ guard self . hasPrefix ( " is " ) , self . count > 2 else {
20+ return false
21+ }
22+
23+ let thirdCharacterIndex = self . index ( self . startIndex, offsetBy: 2 )
24+ return self [ thirdCharacterIndex] . isUppercase
25+ }
26+ }
Original file line number Diff line number Diff line change @@ -30,16 +30,6 @@ extension String {
3030 return " \( f. lowercased ( ) ) \( String ( dropFirst ( ) ) ) "
3131 }
3232
33- /// Returns whether the string is of the format `isX`
34- package var hasJavaBooleanNamingConvention : Bool {
35- guard self . hasPrefix ( " is " ) , self . count > 2 else {
36- return false
37- }
38-
39- let thirdCharacterIndex = self . index ( self . startIndex, offsetBy: 2 )
40- return self [ thirdCharacterIndex] . isUppercase
41- }
42-
4333 /// If the string ends with `.swift`, return it without that suffix;
4434 /// otherwise return self unchanged
4535 package func dropSwiftFileSuffix( ) -> String {
You can’t perform that action at this time.
0 commit comments