MCPcopy Create free account
hub / github.com/BitVM/BitVM / replace_first_n_with_zero

Function replace_first_n_with_zero

bitvm/src/chunk/helpers.rs:92–102  ·  view source on GitHub ↗
(hex_string: &str, n: usize)

Source from the content-addressed store, hash-verified

90 }
91
92 fn replace_first_n_with_zero(hex_string: &str, n: usize) -> String {
93 let mut result = String::new();
94
95 if hex_string.len() <= n {
96 result.push_str(&"0".repeat(hex_string.len())); // If n >= string length, replace all
97 } else {
98 result.push_str(&"0".repeat(n)); // Replace first n characters
99 result.push_str(&hex_string[0..(hex_string.len() - n)]); // Keep the rest of the string
100 }
101 result
102 }
103
104 fn extern_hash_fp_var(fqs: Vec<[u8; 64]>) -> [u8; 64] {
105 let mut vs = Vec::new();

Callers 1

extern_hash_fp_varFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected