Skip to content

Instantly share code, notes, and snippets.

View maretekent's full-sized avatar

kent marete maretekent

  • http://glosoftgroup.com
  • Nairobi Kenya
View GitHub Profile
@maretekent
maretekent / playground.rs
Created April 7, 2018 12:47 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#[allow(dead_code)]
fn encrypt(plaintext: &str, key: usize){
let plaintext = &plaintext.to_uppercase();
let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let mut cipher = String::from("");
for each_char in plaintext.chars(){
match alphabet.find(each_char) {
Some(index) => {
let char_index = (index + key) % 26;
let char_place = alphabet.chars().nth(char_index).unwrap();
@maretekent
maretekent / playground.rs
Created April 6, 2018 12:25 — forked from rust-play/playground.rs
Code shared from the Rust Playground
fn main() {
give();
}
fn give(){
let mut vec = Vec::new();
vec.push(1);
vec.push(2);
take(vec);
vec.push(3);