How to get the last N characters from string in Swift

1 Answer

0 votes
let s = "swift java python c c++"
 
let N = 5 
 
let substring = String(s.suffix(N))

print(substring)
 
 
 
  
/*
run:
  
c c++
  
*/

 



answered Nov 9, 2020 by avibootz
...