Skip to content

Commit 6fd31f6

Browse files
committed
move java bean conventions out of SwiftExtract
1 parent 1cf0a25 commit 6fd31f6

2 files changed

Lines changed: 26 additions & 10 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
}

Sources/SwiftExtract/Convenience/String+Extensions.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)