MCPcopy Create free account
hub / github.com/douglance/devsql / truncate_string

Function truncate_string

crates/ccql/src/cli/output.rs:62–68  ·  view source on GitHub ↗
(s: &str, max_len: usize)

Source from the content-addressed store, hash-verified

60}
61
62pub fn truncate_string(s: &str, max_len: usize) -> String {
63 if s.len() > max_len {
64 format!("{}...", &s.chars().take(max_len - 3).collect::<String>())
65 } else {
66 s.to_string()
67 }
68}
69
70pub fn format_timestamp(ts: i64) -> String {
71 chrono::DateTime::from_timestamp_millis(ts)

Callers 2

searchFunction · 0.85
sqlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected