tjava在talend中的打印输出中获取字符串

发布于 2025-01-20 09:58:05 字数 882 浏览 0 评论 0原文

currently I found an alternative to fetch the string output in Java using Talend Studio:

tJava code:

String output=((String)globalMap.get("tSystem_1_OUTPUT"));

System.out.println("Printing the error code 1 : "+StringUtils.substringBetween(output,"source count:", "destination count:"));

tJava output:

Printing the error code 1 : ', '1000')
('

enter image description here

Expected Result:

Printing the error code 1 : 1000

However, tJava takes the result exactly between string " source count:' " and "目的地计数:“,因此包括括号和所有。 The expected result is only to get the value 1000.

How do I apply this java code to fetch the correct output?

currently I found an alternative to fetch the string output in Java using Talend Studio:

tJava code:

String output=((String)globalMap.get("tSystem_1_OUTPUT"));

System.out.println("Printing the error code 1 : "+StringUtils.substringBetween(output,"source count:", "destination count:"));

tJava output:

Printing the error code 1 : ', '1000')
('

enter image description here

Expected Result:

Printing the error code 1 : 1000

However, tJava takes the result exactly between string " source count:' " and " destination count: ", so that included the bracket and all. The expected result is only to get the value 1000.

How do I apply this java code to fetch the correct output?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡忘如思 2025-01-27 09:58:05

尚未在 Talend 本身内对此进行测试,但尝试一下......

String output=((String)globalMap.get("tSystem_1_OUTPUT"));
var sourceCount = output.split("\\)")[0].split(",")[1].replace("'", "").trim();

System.out.println("Printing the error code 1 : " + sourceCount);

Haven't test this within Talend itself but try this ...

String output=((String)globalMap.get("tSystem_1_OUTPUT"));
var sourceCount = output.split("\\)")[0].split(",")[1].replace("'", "").trim();

System.out.println("Printing the error code 1 : " + sourceCount);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文