How to check if a string start with specific letter in Swift

1 Answer

0 votes
let s = "Swift is a general-purpose, compiled programming language developed by Apple Inc"
  
print(s[s.startIndex] == "S")

if s[s.startIndex] == "S" {
    print(true)
}

   
  
   
/*
run:
 
true
true
  
*/
 

 



answered Sep 2, 2020 by avibootz
...