[Shipped] Add "Trim" Binding Converter

:muscle:Following feature has been shipped.
Find the related help center article here.
Find @Seb’s detail explanation on Custom Script Converter here


It’d be really nice to be able to “Trim” characters from the beginning and end of a binding.

For example, some API’s return image results with Image Source tags. You could cut these out to just obtain the image link in between the quotes. It’d be nice to be able to:

  • Trim X Characters from beginning of text

  • Tim X Characters from end of text.

  • Yes Please!
  • No thanks

0 voters

Hi @AlexB,

Did you try to use the substring method of the text manipulation converter?

If that doesn’t suit your need, you can still use a Custom Script to truncate a text

Seb

1 Like

Hey Seb, actually the string length that I need varies, because the name of the image will vary. For example, I’m trying to extract the url from Item1: <img src-‘https://s3.amazonaws.com/domain.com/imagename1.jpg’/> and Item2: <img src-‘https://s3.amazonaws.com/domain.com/imagenamelonger2.jpg’/>

However, in my case if I could trim the first 10 characters from the beginning, and 3 characters from the end within one custom script, that would help a lot to extract the link. Right now I’m using one text converter to Find/Rplc the beginning tag, and then using another text item bound to the first with a Find/Rplc to remove the ending tag. Just not very efficient.

Custom script should be your friend then :wink:

With the script below:

var t = INPUT.substring(10);
var t2 = t.substring(0, t.length - 3)
t2
1 Like

This is awesome! Thanks Seb.

I think we need an Intuiface post with a repository of all these custom scripts that can be used. They really help a lot!

2 Likes

I second this!

There should be a section where a user should be able to share scripts or plugins/assets.

@bomee.lafitte

Is this possible?

@Seb is this possible? :wink:

Also … regexps :slight_smile:

I’m awfully bad at it, but it works :wink:

Some input for those eager to learn more:

1 Like

@AlexB, @Promultis, @bomee.lafitte: I think we should start a dedicated thread in the Tips - Best Practices section :wink:

@Alex: I hate regexp (coz I’m also bad at writing them) but they’re indeed the most powerful ones for such cases.

[EDIT]: Here’s the new thread to talk about the Custom Script

2 Likes