Solved

Trim remove more than required

  • 13 March 2024
  • 5 replies
  • 47 views

Badge +2

Hi There,

i have workspace and trim transformer - Post/processe/Radarsat2/20240313 for example, it should leave 20240313 name of the file, but it remove 2 at the begining, 0240313 remains as file name. How to keep that “2” at the beginning?

 

icon

Best answer by nielsgerrits 13 March 2024, 15:24

View original

5 replies

Userlevel 6
Badge +34

When I do this I use an AttributeSplitter and a ListIndexer.

Userlevel 3
Badge +18

There’s also an transformer LastSectionOfStringRemover on Hub that might help you here:

https://hub.safe.com/publishers/safe-lab/transformers/lastsectionofstringremover

(split on / and keep last part)

Userlevel 6
Badge +34

There’s also an transformer LastSectionOfStringRemover on Hub that might help you here:

https://hub.safe.com/publishers/safe-lab/transformers/lastsectionofstringremover

(split on / and keep last part)

Also the FilenamePartExtractor should work in this case.

Userlevel 5
Badge +36

Or use a StringSearcher with regular expression \d*$

This will find all digits from the end of the string (or you can use \d{8}$ for exactly the last 8 digits).

 

Badge +2

There’s also an transformer LastSectionOfStringRemover on Hub that might help you here:

https://hub.safe.com/publishers/safe-lab/transformers/lastsectionofstringremover

(split on / and keep last part)

Also the FilenamePartExtractor should work in this case.

Did not know about this transformer, was useful in my case

Reply