Say I have a string here: 說我在這裏有一個字符串: 數組
var fullName: String = "First Last"
I want to split the string base on white space and assign the values to their respective variables 我想在空白處分割字符串並將值分配給它們各自的變量 spa
var fullNameArr = // something like: fullName.explode(" ") var firstName: String = fullNameArr[0] var lastName: String? = fullnameArr[1]
Also, sometimes users might not have a last name. 一樣,有時用戶可能沒有姓氏。 .net