All Projects → ArtSabintsev → Guitar

ArtSabintsev / Guitar

Licence: mit
A Cross-Platform String and Regular Expression Library written in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Guitar

Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+1570.2%)
Mutual labels:  tvos, watchos, cocoapods, carthage, swift-package-manager
Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (-53.98%)
Mutual labels:  tvos, watchos, cocoapods, carthage, swift-package-manager
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (-75.35%)
Mutual labels:  tvos, watchos, cocoapods, carthage, swift-package-manager
L10n Swift
Localization of the application with ability to change language "on the fly" and support for plural form in any language.
Stars: ✭ 177 (-72.39%)
Mutual labels:  tvos, watchos, cocoapods, carthage, swift-package-manager
Randomkit
Random data generation in Swift
Stars: ✭ 1,458 (+127.46%)
Mutual labels:  cross-platform, watchos, cocoapods, carthage, swift-package-manager
Ducttape
📦 KeyPath dynamicMemberLookup based syntax sugar for Swift.
Stars: ✭ 138 (-78.47%)
Mutual labels:  tvos, watchos, cocoapods, carthage, swift-package-manager
Functionkit
A framework for functional types and operations designed to fit naturally into Swift.
Stars: ✭ 302 (-52.89%)
Mutual labels:  tvos, watchos, cocoapods, carthage, swift-package-manager
Swiftlinkpreview
It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.
Stars: ✭ 1,216 (+89.7%)
Mutual labels:  tvos, watchos, cocoapods, carthage, swift-package-manager
Swiftframeworktemplate
A template for new Swift iOS / macOS / tvOS / watchOS Framework project ready with travis-ci, cocoapods, Carthage, SwiftPM and a Readme file
Stars: ✭ 527 (-17.78%)
Mutual labels:  tvos, watchos, cocoapods, carthage, swift-package-manager
Color
Color utilities for macOS, iOS, tvOS, and watchOS
Stars: ✭ 145 (-77.38%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Cocoalumberjack
A fast & simple, yet powerful & flexible logging framework for Mac and iOS
Stars: ✭ 12,584 (+1863.18%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Iso8601
ISO8601 date parser and writer
Stars: ✭ 213 (-66.77%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Contentful.swift
A delightful Swift interface to Contentful's content delivery API.
Stars: ✭ 132 (-79.41%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Amplitude Ios
Native iOS/tvOS/macOS SDK
Stars: ✭ 216 (-66.3%)
Mutual labels:  tvos, cocoapods, carthage, swift-package-manager
Sablurimageview
You can use blur effect and it's animation easily to call only two methods.
Stars: ✭ 538 (-16.07%)
Mutual labels:  tvos, cocoapods, carthage, swift-package-manager
Datez
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!
Stars: ✭ 254 (-60.37%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Mechanica
A cross-platform library of Swift utils to ease your iOS | macOS | watchOS | tvOS and Linux development.
Stars: ✭ 27 (-95.79%)
Mutual labels:  tvos, watchos, carthage, swift-package-manager
Skeletonui
☠️ Elegant skeleton loading animation in SwiftUI and Combine
Stars: ✭ 275 (-57.1%)
Mutual labels:  tvos, watchos, cocoapods, swift-package-manager
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-81.44%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Dots
Lightweight Concurrent Networking Framework
Stars: ✭ 35 (-94.54%)
Mutual labels:  tvos, watchos, carthage, swift-package-manager

Guitar 🎸

A Cross-Platform String and Regular Expression Library written in Swift.

Build Status Platform

Swift Support CocoaPods SwiftPM Compatible

About

This library seeks to add common string manipulation functions, including common regular expression capabilities, that are needed in both mobile and server-side development, but are missing in Swift's Standard Library.

The full documentation can be found at http://www.sabintsev.com/Guitar/.

Guitar is also part of Swift's Source Compatibility Suite.

Features

  • [x] Boolean Functions (isAlpha, isNumeric, isUppercase, etc.)
  • [x] Case Functions (camelCased, pascalCased, kebabCased, etc.)
  • [x] Latinization Functions (.latinized(), .withoutAccents())
  • [x] Padding Functions (padLeft, padRight, pad)
  • [x] Regular Expressions (with Common Patterns Built-in)

Sherlocked

A small set of functions offered by Guitar were removed in v0.3.0 of the library as Apple added many of these features to the Swift 4 language (aka, Sherlocking). The functions that were removed were: first, last, length, prefixed, suffixed, trimLeft, trimRight, truncated. The reversed function was renamed to reversedString as it acts slightly differently than Swift's built-in reversed function.

Installation Instructions

Swift Version Branch Name Will Continue to Receive Updates?
5.1+ master Yes
5.0 swift5.0 No
4.2 swift4.2 No
4.1 swift4.1 No
3.2 swift3.2 No
3.1 swift3.1 No

CocoaPods

pod 'Guitar' # Swift 5.1+
pod 'Guitar', :git => 'https://github.com/ArtSabintsev/Guitar.git', :branch => 'swift5.0' # Swift 5.0
pod 'Guitar', :git => 'https://github.com/ArtSabintsev/Guitar.git', :branch => 'swift4.2' # Swift 4.2
pod 'Guitar', :git => 'https://github.com/ArtSabintsev/Guitar.git', :branch => 'swift4.1' # Swift 4.1
pod 'Guitar', :git => 'https://github.com/ArtSabintsev/Guitar.git', :branch => 'swift3.2' # Swift 3.2
pod 'Guitar', :git => 'https://github.com/ArtSabintsev/Guitar.git', :branch => 'swift3.1' # Swift 3.1

Swift Package Manager

.Package(url: "https://github.com/ArtSabintsev/Guitar.git", majorVersion: 1)

Usage Examples

Regular Expression

  • Guitar makes it easier to use Regular Expressions to test and evaluate String objects.
  • Guitar.Chord enumerates common regular expressions and they are located in GuitarChord.swift.
  • GuitarCommon.swift contains a list of convenience methods for common regular expression evaluations and tests, such as checking the string to determine if it's a valid email address.

Initialization

Guitar(pattern: String) // A custom regular expression with which to initialize Guitar.

Guitar(chord: Guitar.Chord) // A common regular expression with which to initialize Guitar.

Methods

evaluateForRanges(::) returns an array of ranges, [Range<String.Index>], that match a specific regular expression.

Guitar(chord: .firstCharacter).evaluateForRanges(from: "Hello world") // [Range(Swift.String.CharacterView.Index(_base: Swift.String.UnicodeScalarView.Index(_position: 0), _countUTF16: 1)..<Swift.String.CharacterView.Index(_base: Swift.String.UnicodeScalarView.Index(_position: 1), _countUTF16: 1)), Range(Swift.String.CharacterView.Index(_base: Swift.String.UnicodeScalarView.Index(_position: 6), _countUTF16: 1)..<Swift.String.CharacterView.Index(_base: Swift.String.UnicodeScalarView.Index(_position: 7), _countUTF16: 1))]

evaluateForStrings(::) returns an array of strings, [String], that match a specific regular expression.

Guitar(chord: .firstCharacter).evaluateForStrings(from: "Hello world") // ["H", "w"]

test(::) evaluates a string with a specific regular expression. true is returned if matches are found in the string. Otherwise, false is returned.

Guitar(chord: .email).test(string: "[email protected]") // `true`

String Extension

This library also adds dozens of methods via String extensions that are missing in the Swift Standard Library or not easily accessible on the String class. Check GuitarBoolean.swift and GuitarPadding.swift to see these examples.

More specific examples can be found in the tests folder.

Inspiration

Created and maintained by

Arthur Ariel Sabintsev

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].