arc-reactor 0.2.4

Minimal, Asynchronous, Web Framework
Documentation
1
2
3
4
5
6
7
8
9
10
/// Removes any '/' that may exist as the last character in a string.
pub(crate) fn stripTrailingSlash(string: &str) -> &str {
	let len = string.chars().count();
	let lastChar = string.get((len - 1)..).unwrap(); // this unwrap makes me uncomfortable
	if lastChar == "/" {
		return string.get(..(len - 1)).unwrap(); // so does this
	}

	return string;
}