Guitar alternatives and similar libraries
Based on the "Text" category.
Alternatively, view Guitar alternatives based on common mentions on social networks and blogs.
-
PhoneNumberKit
A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber. -
ZSSRichTextEditor
A beautiful rich text WYSIWYG editor for iOS with a syntax highlighted source view -
Twitter Text Obj
Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform. -
FontAwesomeKit
Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons. -
TwitterTextEditor
A standalone, flexible API that provides a full-featured rich text editor for iOS applications. -
RichEditorView
DISCONTINUED. RichEditorView is a simple, modular, drop-in UIView subclass for Rich Text Editing. -
SwiftyMarkdown
Converts Markdown files and strings into NSAttributedStrings with lots of customisation options. -
Atributika
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement. -
SwiftIconFont
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon) -
NSStringEmojize
A category on NSString to convert Emoji Cheat Sheet codes to their equivalent Unicode characters -
Mustard
🌭 Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it. -
Heimdall
Heimdall is a wrapper around the Security framework for simple encryption/decryption operations. -
AttributedTextView
Easiest way to create an attributed UITextView (with support for multiple links and from html)
WorkOS - The modern identity platform for B2B SaaS
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Guitar or a related project?
README
Guitar 🎸
A Cross-Platform String and Regular Expression Library written in Swift.
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 evaluateString
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.