Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #4818 #4823

Merged
merged 2 commits into from
Jan 30, 2025
Merged

fix #4818 #4823

merged 2 commits into from
Jan 30, 2025

Conversation

sramazzina
Copy link
Contributor

@sramazzina sramazzina commented Jan 24, 2025

fix #4818 Concat transform does not trim fields


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Run mvn clean install apache-rat:check to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If you have a group of commits related to the same change, please squash your commits into one and force push your branch using git rebase -i.
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable.

To make clear that you license your contribution under the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Comment on lines 180 to 195
if (trimType != null) {
switch (trimType) {
case ConcatFieldsMeta.TRIM_TYPE_LEFT:
targetField.append(valueMeta.getString(valueData).replaceAll("^\\s+", ""));
break;
case ConcatFieldsMeta.TRIM_TYPE_RIGHT:
targetField.append(valueMeta.getString(valueData).replaceAll("\\s+$", ""));
break;
case ConcatFieldsMeta.TRIM_TYPE_BOTH:
targetField.append(valueMeta.getString(valueData).trim());
break;
default:
targetField.append(valueMeta.getString(valueData));
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a function in Const -> org.apache.hop.core.Const#trimToType

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know let me use it and fix the code

@sramazzina
Copy link
Contributor Author

@hansva I applied the change you suggested

@hansva hansva merged commit a9a4600 into apache:main Jan 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Concat transform does not trim fields
2 participants