LLAExtensionPack 1.0.10

LLAExtensionPack 1.0.10

Maintained by Daisuke T.




  • By
  • daisuke-t-jp


Platform Language Swift%205.0 Carthage compatible Cocoapods Build Status

Swift Extension Pack 📦

Install

Carthage

github "daisuke-t-jp/LLAExtensionPack"

CocoaPods

use_frameworks!

target 'target' do
pod 'LLAExtensionPack'
end

Extensions

Foundation

CoreGraphics

CoreAnimation

UIKit

CoreLocation

Example

Swift code

import LLAExtensionPack

/**
 * Example "String"
 */
// Compare
"string".isEqual("String", caseInsensitive: true) // true

// Find
"string".hasPrefix("Str", caseInsensitive: true) // true
"string".hasSuffix("Ing", caseInsensitive: true) // true

// Substring
"string"[str.startIndex(0)!...str.startIndex(2)!] // "str"
"string".substring(NSMakeRange(1, 3)), "tri"

// Subscript
"string"[0...2] // "str"
"string"[1...3] // "tri"

// Inspect
"1".isNumeric // true
"ABC".isNumeric // false

// Replace
"string".replace("str", replacement: "STR") // "STRing"
"string".replace("STR", replacement: "", caseInsensitive: true) // "ing"

// Remove
"string".remove("str") // "ing"
"string".remove("STR", caseInsensitive: true) // "ing"

// Encode
"abcABC1234/?-._~".urlEncoding // "abcABC1234/?-._~"
":#[]@!$&'()*+,;=".urlEncoding // "%3A%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D"

// Hash
"string".md2 // "a06d078cf87b3349d4400afca892ed42"
"string".md4 // "70a2421dd08cce128b3af8ad1dfa74ac"
"string".md5 // "b45cffe084dd3d20d928bee85e7b0f21"
"string".sha1 // "ecb252044b5ea0f679ee78ec1a12904739e2904d"
"string".sha224 // "474b4afcaa4303cfc8f697162784293e812f12e2842551d726db8037"
"string".sha256 // "473287f8298dba7163a897908958f7c0eae733e25d2e027992ea2edc9bed2fa8"
"string".sha384 // "36396a7e4de3fa1c2156ad291350adf507d11a8f8be8b124a028c5db40785803ca35a7fc97a6748d85b253babab7953e"
"string".sha512 // "2757cb3cafc39af451abb2697be79b4ab61d63d74d85b0418629de8c26811b529f3f3780d0150063ff55a2beee74c4ec102a2a2731a1f1f7f10d473ad18a6a87"