swift手记-6

//
// ViewController.swift
// learn
//
// Created by myhaspl on 16/1/26.
// Copyright (c) 2016年 myhaspl. All rights reserved.
// import Cocoa class ViewController: NSViewController { override func viewDidLoad() {
super.viewDidLoad() // Do any additional setup after loading the view.
} override var representedObject: AnyObject? {
didSet {
// Update the view, if already loaded.
}
} @IBOutlet weak var hashresult: NSTextField!
@IBOutlet weak var sourcestr: NSTextField!
@IBAction func hashbutton(sender: AnyObject) {
let sourcestring=sourcestr.stringValue
var hashres:Int64=1
var str:String
for charascii in sourcestring.utf8{
str="\(charascii)"
hashres = str.toInt()! + 33 * hashres
}
hashresult.stringValue=String(hashres)
}
}

字符串HASH

本博客全部内容是原创,假设转载请注明来源

http://blog.csdn.net/myhaspl/

swift手记-6

上一篇:java中的二维数组基础知识


下一篇:python离线下载和安装库