pub fn truncate_n<'t>(lt: &'t str, n: usize) -> &'t strExpand description
Trancates the string up to closest to N byte equiv UTF8 if string exceeds size
For example:
ボルテ ‘e3 83 9c e3 83 ab e3 83 86’ with N=3
will give ‘ボ’
ボルテ ‘e3 83 9c e3 83 ab e3 83 86’ with N=4
will give ‘ボ’
ボルテ ‘e3 83 9c e3 83 ab e3 83 86’ with N=1
will give ‘’
§Arguments
-
lt- a string to truncate -
n- a size (in bytes, not in chars)
§Returns
- The new instance of String even if no action was required