I have the variable called values = "2"
. Now when the value length == 1
i need to add 0
at before the value.And if the value length ==2
no need to do any thing.How can i add 0
at before.
And when i try to convert int to string.And when i get the last 6 digit Like :
Number = "123456789"
Here when i try to get last 5 digit value.Then its printing like :
[ "7" "8" "9" ")" """ ]
How to extract numbers alone..Here my code :
let Acc = info.TotalNo
let U = "\(Acc)"
let AccountNos = String(U.characters.suffix(5))
let list = AccountNos.characters.map { String($0) }
Then its printing like this :
[ "7" "8" "9" " closeBracket" " double colon " ]
But i want :
[ "5" "6" "7" "8" "9" ]
I know 2 question is not allowed..But tis two making me to break more code..Please give me some solution..
Thanks