Skip to content

Instantly share code, notes, and snippets.

View chadparker's full-sized avatar

Chad Parker chadparker

View GitHub Profile
@chadparker
chadparker / a.md
Created March 24, 2025 05:16
Test 1

This is a test.

import Foundation
extension String {
func anotherContains(_ input: String) -> Bool {
let selfString = self.lowercased()
let inputString = input.lowercased()
return selfString.range(of: inputString) != nil
}
}
import Foundation
func expandTheNumber(_ number: Int) -> [Int] {
// get array of digits
let digits = String(number).map { Int(String($0))! }
// get array of reversed indexes, i.e. [2, 1, 0]
let reversedIndexes = Array(digits.enumerated().map { $0.offset }.reversed())
@chadparker
chadparker / palindrome.swift
Last active February 11, 2020 04:21
Palindrome checker
import Foundation
// Requirements:
// ignore case, whitespace, and punctuation
// check from each end of the string
// deal with even or odd amount of characters
func canBePalindrome(_ string: String) -> Bool {
var preparedString = string.lowercased()