Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你好我想测试字符串是否包含字符_然后我们stringHandling.CHANGE(StringHandling.LEFT(row1.B,9),"_","S")什么都不做。我不知道如何与 talend 一起做,谁能帮助我
stringHandling.CHANGE(StringHandling.LEFT(row1.B,9),"_","S")
row1.B.contains("_")?StringHandling.CHANGE(StringHandling.LEFT(row1.B,9),"_","S")
在这种情况下不要使用三元运算符(?:),因为它需要左侧的赋值运算符和右侧的两个选项(不适合)。
对于单个字符存在检查,我更喜欢indexOf如下:
indexOf
if(row1.B != null && row1.B.indexOf('_')>=0){ StringHandling.CHANGE(StringHandling.LEFT(row1.B,9),"_","S"); }