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?

  • 2 August 2016
  • 3 replies
  • 4 views

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

Userlevel 2
Badge +17

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
Badge +9

@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.

Badge +16

Have you tried the DateFormatter?

Reply