I have a Java transform code, but I can't use it.
numbStr_All = replaceString.split("Home", -1).length -1;
I need the equivalent code in expression language please.
I don't think that can be converted to the available functions in the Expression Tx. As you have the java code to perform the task I'd suggest using the Java Tx or you could try using a regex expression.
1 of 1 people found this helpful
In PowerCenter I would try this one:
(Length( inputport) - Length( ReplaceStr( 0, inputport, 'home', ''))) / Length( 'home')
This should yield the value 2 in your case:
- inputport contains 47 characters.
- ReplaceStr() will yield ", is where wifi connects automatically" (39 characters).
- 47 - 39 = 8 characters which have been removed by ReplaceStr().
- 8 / 4 (length of string searched for) = 2 occurrences of "home".
Again, this is PowerCenter syntax; no idea whether this works on the platform resp. in IDQ as well.
It should work fine Nico. Interesting approach!
that's just the "dumb programmer's" approach, nothing special about it.