VesselWheel

Raw String 본문

Xcode Study

Raw String

JasonYang 2023. 10. 16. 14:41

import UIKit

 

// Raw String

 

var str1 = "Hello, Swift5.7"

print(str1)

 

str1 = "Hello, \"Swift5.7\""

print(str1)

 

var rawStr1 = #"Hello, \"Swift5.7\""#

print(rawStr1)

 

var str2 = "Hello\nSwift5.7"

print(str2)

 

str2 = #"Hello\nSwift5.7"#

print(str2)

 

let number = 1000

str1 = "number 는 \(number)입니다"

print(str1)

 

str1 = #"number 는 \(number)입니다"#

print(str1)

 

var zipCodeRegex = "^\\d{3}-?\\d{3}$"

zipCodeRegex = #"^\d{3}-?\d{3}$"#

 

let zipCode = "123-456"

if let _ = zipCode.range(of: zipCodeRegex, options:[.regularExpression]){

    print("valid")

}

 

 

 

 

 

 

'Xcode Study' 카테고리의 다른 글

문자를 화면에 출력하는 컨트롤  (0) 2023.10.16
ContentView(SwiftUI)  (0) 2023.10.16
Foundation String  (1) 2023.10.16
String / Character  (0) 2023.10.16
Tuple Decomposition  (0) 2023.10.16