# Truncating the string length in Formatting.jl

**URL:** <https://discourse.julialang.org/t/truncating-the-string-length-in-formatting-jl/42834>\
**Category:** General Usage\
**Tags:** strings, formatting\
**Created:** [July 10, 2020, 8:50am UTC](https://discourse.julialang.org/t/truncating-the-string-length-in-formatting-jl/42834 "2020-07-10T08:50:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [July 10, 2020, 8:50am UTC](https://discourse.julialang.org/t/truncating-the-string-length-in-formatting-jl/42834/1 "2020-07-10T08:50:17Z")

</div>

In this snippet:

```julia
using Formatting
s = "123456789"
printfmtln("{}--{:6.6s}", s, s) 

```

I would like the second occurrence of `s` to be truncated to 6 characters, but I’m getting:

```julia
123456789--123456789

```

Is there a format definition, which does it? Looking at Python docs, I thought that `{:6.6s}` should do it.

---

<div class="post-metadata">

**Author:** ![jmkuhn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmkuhn/32/2090_2.png) [@jmkuhn](https://discourse.julialang.org/u/jmkuhn)\
**Post date:** [July 13, 2020, 2:23pm UTC](https://discourse.julialang.org/t/truncating-the-string-length-in-formatting-jl/42834/2 "2020-07-13T14:23:27Z")

</div>

This should work. I have filed an [issue](https://github.com/JuliaIO/Formatting.jl/issues/83) for this
