Overview
- Write an extension to string, that returns
true and false depending upon the presence of special characters.
- Extension should be declared as
public
- Methods or properties could be declared as
static
Sample
let str1: String = "abcsg$"
str1.haveSpecialChar() // true
let str2: String = "sfasdf"
str2.haveSpecialChar() // false
Code Path
- Sources -> Extended -> Public -> Extension -> String.swift
Discussion
Overview
trueandfalsedepending upon the presence of special characters.publicstaticSample
Code Path
Discussion