Skip to main content
Question

I have an attribute with dd:ddddd:sssssss and I want to trim this down to dd:ddddd only. Is StringFormatter the best transformer to use?


jordiew
Participant
I have an attribute with dd:ddddd:sssssss and I want to trim this down to dd:ddddd only. Is StringFormatter the best transformer to use?

3 replies

takashi
Evangelist
  • August 2, 2016

Hi @jordiew, there are some choices, but I think the SubstringExtractor is easier if the number of characters which should be extracted is fixed.

  • Start Index: 0
  • End Index: 7

ciarab
Contributor
Forum|alt.badge.img+9
  • Contributor
  • August 2, 2016

@jordiew You can use the AttributeTrimmer to trim off groups of different characters, its intended use is to remove things like leading and trailing characters so you could give that a go.

If the part of the attribute you are trying to remove can change length and characters, then AttributeSplitter might be more useful to you, splitting on ":" to create a list attribute containing the various parts of you original attribute from here you can create a new attribute by concatenating list elements 0 and 1 and placing a ":" in between the 2 list values.


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • August 2, 2016

Have you tried the DateFormatter?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings