所以说我有
x = [1,2,3,4,5,6]
y = [2,3,4]
有没有办法检查y
中的x
是否完全符合其中的顺序?
如果true
位于y
,那么if x
就像import UIKit
import Parse
import Starscream
class ViewController: UIViewController, WebSocketDelegate {
var socket = WebSocket(url: NSURL(scheme: "ws", host: "ws.pusherapp.com/app/API_KEY?protocol=7", path: "/")!)
override func viewDidLoad() {
super.viewDidLoad()
self.socket.delegate = self
self.socket.connect()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func disconnectWasTapped(sender: UIButton) {
self.socket.disconnect()
}
// MARK: WebSocket
func websocketDidConnect(socket: WebSocket) {
println("websocket is connected")
}
func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
println("websocket is disconnected: \(error?.localizedDescription)")
}
func websocketDidReceiveMessage(socket: WebSocket, text: String) {
//println("got some text!!")
println("got some text: \(text)")
}
func websocketDidReceiveData(socket: WebSocket, data: NSData) {
println("got some data: \(data.length)")
}
}
一样?