Trimming a string - Cloud - 7.3

Talend Studio User Guide

Version
Cloud
7.3
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development
Last publication date
2024-02-13

It is easy to use the talendTrim routine, along with a tJava component to remove the string padding characters from the start and end of the string:

System.out.println(TalendString.talendTrim("**talend open Studio****",'*', -1));
System.out.println(TalendString.talendTrim("**talend open Studio****",'*', 1)); 
System.out.println(TalendString.talendTrim("**talend open Studio****",'*',0));

The star characters are removed from the start, then the end of the string and then finally from both ends: