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/




posted @ 2017-07-06 17:25  wzjhoutai  阅读(157)  评论(0编辑  收藏  举报