From af53186e6a600b2dccf6d3b244cd9f58be1c0799 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 2 Mar 2019 16:12:34 +0100 Subject: [PATCH] src/tools.rs: add simply string join --- src/tools.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tools.rs b/src/tools.rs index 006a66a4..d7b80751 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -475,3 +475,15 @@ pub fn extract_auth_cookie(cookie: &str, cookie_name: &str) -> Option { None } + +pub fn join(data: &Vec, sep: char) -> String { + + let mut list = String::new(); + + for item in data { + if list.len() != 0 { list.push(sep); } + list.push_str(item); + } + + list +}