Answers for "swift string concatenation"

1

swift string concatenation

let age = 28
let name = "John"
let isAlcoholic = true

var description = "\(name) is \(age) years old and \(isAlcoholic ? "is" : "isn't") alcoholic"
Posted by: Guest on February-22-2021
1

concatenate two strings in swift

var greet = "Hello, "
let name = "Jack"

// using + operator
var result = greet + name
print(result)

//using =+ operator
greet +=  name
print(greet)
Posted by: Guest on May-07-2021
1

concatenate string swift

let string1 = "hello"
let string2 = " there"
var welcome = string1 + string2 // hello there
Posted by: Guest on February-11-2021
0

declare empty string in swift

// Create a literal empty string
var emptyString = ""

// Create an optional string
var emptyVariable: String?  // This allows this variable to have a null value, or nil in swift
Posted by: Guest on May-22-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language