nanocl_utils 0.4.0

Nanocl shared utils
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub fn format_version(version: &str) -> String {
  let mut index = 0;
  let mut dot_count = 0;
  for (i, c) in version.chars().enumerate() {
    if c == '.' {
      dot_count += 1;
      if dot_count == 2 {
        index = i;
        break;
      }
    }
  }
  // Extract the substring up to the second dot
  version[..index].to_owned()
}