PricingBlog

Truncate Text

  • tcg.store-1276181793371848824

    TCG.Store

    1 year ago

    Any simple way of eclipsing text in toddle.

    for example, "long string here" --> "long string..."

    I didn't see a .slice or anything like that in the list but thought i'd ask just in case i missed.
  • lucasg-1276186276151820379

    Lucas G

    1 year ago

    You can use the Split node
  • Split by “space” and the take first 3 and last 3 for example
  • tcg.store-1276188761365151856

    TCG.Store

    1 year ago

    thanks @Lucas G for this tip, let me give it a try
  • tcg.store-1276191534429110435

    TCG.Store

    1 year ago

    any documentation you can point me to? I was able to remove some characters but not truncate properly. I think i'm not using it properly
  • jacobkofoed-1276194248659828836

    Jacob Kofoed

    1 year ago

    I think "take" and "take last" formulas also works on strings if you want to take a specific amount of characters. The best option visually is to use overflow ellipsis with CSS https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow
  • lucasg-1276194815087742976

    Lucas G

    1 year ago

    I agree on using CSS, almost always the better route over JS.
  • I suggested the split route since it seemed like what was asked was for the beginning and end of a long string
  • Good to know that we can just use take nodes though