Latest 0.4.0
Homepage https://github.com/tikidunpon/SwiftMoji
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Code Climate
codecov
Version
License
[Swift-3.0]()

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Methods

between()

"<a>foo</a>".between("<a>", "</a>") // "foo"
"<a><a>foo</a></a>".between("<a>", "</a>") // "<a>foo</a>"
"<a>foo".between("<a>", "</a>") // nil
"Some strings } are very {weird}, dont you think?".between("{", "}") // "weird"
"<a></a>".between("<a>", "</a>") // nil
"<a>foo</a>".between("<a>", "<a>") // nil

matches()

let matches = "Swift Moji 9876".matches(regex: "^(.+)\s(\d{4})")

// first is the entire capture
matches.first // "Swift Moji 9876"

// individual capture groups begin from [1]
matches[1] // "Swift Moji"
matches.last // "2017"

first()

"abc".first() // "a"

second()

"abc".second() // "b"

last()

"abc".last() // "c"

hiragana()

String.hiragana() 
//ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔゕゖ

katakana()

String.katakana() 
//ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ

camelized()

"abc_def".camelized() // "AbcDef"

snakecased()

"UserId".snakecased() // "user_id"

trimmed() trimmedLeft() trimmedRight()

"   abcdef   ".trimmed()      // "abcdef"
"   abcdef   ".trimmedLeft()  // "abcdef   "
"   abcdef   ".trimmedRight() // "   abcdef"

uppercasedFirst()

"abc".uppercasedFirst() // "Abc"

lowercasedFirst()

"ABC".lowercasedFirst() // "aBC"

truncated()

"Returns the truncated string".truncated(length: 10)  // "Returns th..."
"Returns the truncated string".truncated(length: 10, trailing: "・・・")  // "Returns th・・・"

isCapitalized()

"Abc".isCapitalized() // "true"
"abc".isCapitalized() // "false"

isUppercased()

"ABC".isOnlyUppercased()   // "true"
"A_B_C".isOnlyUppercased() // "false"

isLowercased()

"abc".isOnlyLowercased()   // "true"
"a_b_c".isOnlyLowercased() // "false"

isUpperCamelized()

"UserId".isUpperCamelized() // "true"
"userId".isUpperCamelized() // "false"

isLowerCamelized()

"userId".isLowerCamelized() // "true"
"UserId".isLowerCamelized() // "false"

isAlphabet()

"abc".isAlphabet() // "true"
"123".isAlphabet() // "false"
"   ".isAlphabet() // "false"

isNumeric()

"-1.983388".isNumeric() // "true"
"abc".isNumeric()       // "false"

isHiragana()

"あいうえお".isHiragana() // "true"
"abc".isHiragana()      // "false"

isKatakana()

"アイウエオ".isKatakana() // "true"
"abc".isKatakana()      // "false"

Installation

SwiftMoji is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SwiftMoji"

Author

tikidunpon, https://twitter.com/tikidunpon

License

SwiftMoji is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SwiftMoji",
    "version": "0.4.0",
    "summary": "A Simple Swift String Extension",
    "description": "Simple Swift String ExtensionnIt provides method like.. 'camelized', 'snakecased' and so on...",
    "homepage": "https://github.com/tikidunpon/SwiftMoji",
    "license": "MIT",
    "authors": {
        "koichi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tikidunpon/SwiftMoji.git",
        "tag": "0.4.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "xcconfig": {
        "SWIFT_VERSION": "4"
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This