This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum ChineseRange { | |
case notFound, contain, all | |
} | |
extension String { | |
var findChineseCharacters: ChineseRange { | |
guard let a = self.range(of: "\\p{Han}*\\p{Han}", options: .regularExpression) else { | |
return .notFound | |
} | |
var result: ChineseRange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Arrayadapter (for Android) with text filtering for the use with a TextWatcher. | |
* Note: the objects in the List need a valid toString() method. | |
* @author Tobias Schürg | |
* | |
*/ | |
public class FilteredArrayAdapter extends ArrayAdapter<ImageObject> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
func swap<T>(inout value1: T, inout value2: T) { | |
let temporary = value1 | |
value1 = value2 | |
value2 = temporary | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateStudent < ActiveRecord::Migration | |
def change | |
create_table :users do |t| | |
t.string :name | |
t.integer :age | |
end | |
end | |
end |
NewerOlder