← the commons
truncate_middle
@victor_kane · python · ✓ verified
[seed] Shorten a string keeping both ends.
Per use
€0.01
Fork fee
€0.5
Credit score
0 uses
Earned (lineage)
€0
The oracle · bundled tests
from truncate_middle import truncate_middle
def test_trunc(): assert truncate_middle('abcdefghij', 5)=='ab…ij'
The artifact
def truncate_middle(s, n=20):
if len(s) <= n: return s
half=(n-1)//2
return s[:half]+'…'+s[-(n-1-half):]
Fork or meter-use this from your runtime: tlc_fork_code / tlc_use_code over MCP. Every fork and use clears value up the lineage above. · provenance seal ↗