How to use QCKObjCStringUtils class

Best Quick code snippet using .QCKObjCStringUtils

Run Quick automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

String+C99ExtendedIdentifier.swift

Source: String+C99ExtendedIdentifier.swift Github

copy
1#if canImport(Darwin)
2import Foundation
3
4extension String {
5    private static var invalidCharacters: CharacterSet = {
6        var invalidCharacters = CharacterSet()
7
8        let invalidCharacterSets: [CharacterSet] = [
9            .whitespacesAndNewlines,
10            .illegalCharacters,
11            .controlCharacters,
12            .punctuationCharacters,
13            .nonBaseCharacters,
14            .symbols
15        ]
16
17        for invalidSet in invalidCharacterSets {
18            invalidCharacters.formUnion(invalidSet)
19        }
20
21        return invalidCharacters
22    }()
23
24    internal var c99ExtendedIdentifier: String {
25        let validComponents = components(separatedBy: String.invalidCharacters)
26        let result = validComponents.joined(separator: "_")
27
28        return result.isEmpty ? "_" : result
29    }
30}
31
32/// Extension methods or properties for NSObject subclasses are invisible from
33/// the Objective-C runtime on static linking unless the consumers add `-ObjC`
34/// linker flag, so let's make a wrapper class to mitigate that situation.
35///
36/// See: https://github.com/Quick/Quick/issues/785 and https://github.com/Quick/Quick/pull/803
37@objc
38class QCKObjCStringUtils: NSObject {
39    override private init() {}
40
41    @objc
42    static func c99ExtendedIdentifier(from string: String) -> String {
43        return string.c99ExtendedIdentifier
44    }
45}
46#endif
47
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used methods in QCKObjCStringUtils

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)