IceCreamSandwich

1.1.0

Identify Ice Cream Sandwich patterns within strings, collections, and integers
jaroshevskii/swift-ice-cream-sandwich

What's New

IceCreamSandwich 1.1.0

2024-01-14T22:43:28Z

What's New?

  • Collection Support: Manage collections effortlessly (#3).
  • Integers Support: Now you can work seamlessly with integers (#4).

Improvements

  • Documentation Updates: Updated README for better clarity (#2).
  • Bug Fixes: Minor fixes for a smoother experience.

Language Support

Compatibility

Swift Support: Added compatibility for Swift 5.4.

Explore More

Full Changelog: v1.0.0...v1.1.0

Language: πŸ‡ΊπŸ‡Έ English | πŸ‡ΊπŸ‡¦ Π£ΠΊΡ€Π°Ρ—Π½ΡΡŒΠΊΠ° | πŸ‡―πŸ‡΅ ζ—₯本θͺž

🍨 IceCreamSandwich

IceCreamSandwich is a versatile Swift library designed to identify Ice Cream Sandwich patterns within strings, collections, and integers. Originally created for the first task in Chapter 1 of the aCode C++ Practice Tasks.

IceCreamSandwich seamlessly handles collections and integers through extensions that conform to the Hashable and BinaryInteger protocols.

Stand With Ukraine

Definition

An Ice Cream Sandwich is a pattern with matching and distinct left and right ends, enveloping a unique middle portion.

Examples

  • "AABBBAA"
  • [1, 2, 3, 3, 2, 1]
  • 505

Criteria

  1. Distinct Ends: Left and right ends must match in both length and repeated characters.
  2. Unique Middle: The middle portion is distinct from the ends.
  3. Minimum Length: Must be at least 3 characters.

Usage

To use the IceCreamSandwich library, include it in your project and utilize the isIceCreamSandwich property on instances.

import IceCreamSandwich

// String
let smileySandwich = "😊😊🍦😊😊"
if smileySandwich.isIceCreamSandwich {
    print("Yay! You've created an Ice Cream Sandwich!")
} else {
    print("Oops! Your arrangement doesn't form an Ice Cream Sandwich.")
}

// Collection
let numberSandwich = [1, 2, 3, 3, 2, 1]
if numberSandwich.isIceCreamSandwich {
    print("Congratulations! You've assembled a numeric Ice Cream Sandwich!")
} else {
    print("Oops! Your arrangement doesn't form a numeric Ice Cream Sandwich.")
}

// Integer
let integerSandwich = 505
if integerSandwich.isIceCreamSandwich {
    print("Awesome! You've crafted a numeric Ice Cream Sandwich!")
} else {
    print("Oops! Your numeric arrangement doesn't form an Ice Cream Sandwich.")
}

Installation

Xcode

  1. In Xcode, go to File > Swift Packages > Add Package Dependency...
  2. Enter the URL: https://github.com/jaroshevskii/swift-ice-cream-sandwich.git
  3. Specify the desired version or use the latest, and follow the installation prompts.

For more information on adding Swift Packages to Xcode, you can read the Hacking with Swift tutorial.

Swift Package Manager

  1. Add IceCreamSandwich to your Package.swift file as a dependency:

    dependencies: [
        .package(url: "https://github.com/jaroshevskii/ice-cream-snadwich.git", from: "1.0.0"),
    ],
    targets: [
        .target(name: "YourTarget", dependencies: ["IceCreamSandwich"]),
    ]
  2. Run swift build to fetch and integrate the package into your project.

Contributions

Feel free to contribute, report issues, or suggest improvements! Let's make IceCreamSandwich even more delightful.

License

Licensed under the MIT license.

Description

  • Swift Tools 5.4.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Oct 17 2024 20:33:22 GMT-0900 (Hawaii-Aleutian Daylight Time)