Code Snippet: Check if String Begins with Prefix and Retrieve Remainder

From Coder Merlin™

Swift

let s = "Alpha:Bravo:Charlie:Delta"  

let alpha = "Alpha:"
if s.starts(with:alpha) {
    print(s.dropFirst(alpha.count))
}

Python

s = 'Alpha:Bravo:Charlie:Delta'

alpha = 'Alpha:'
if s.startswith(alpha):
    print(s[len(alpha):])