bhushan008
(Bhushan Dhodi)
1
Hi Experts,
Is there any way to check if any particular string exists into another string?
For example
String A=“abcd”
String B=“qwertabcdsdfgh”
The method B.contains(A) returns false.
If String A and B are exactly same then only B.contains(A) returns true.
We need solution where comparing String A and B should return true as String A exists into String B.
Regards,
Bhushan Dhodi
Hi @bhushan008,
try to use it:
import org.apache.commons.lang3.StringUtils;
StringUtils.containsIgnoreCase(B, A);
Also, exist String.matches() function but it works with regex.
bhushan008
(Bhushan Dhodi)
3
Hi @enistri_devo ,
We need to compare two strings in transform.
Will it work in transform as well?
Any documentation do we have on available methods?
Regards,
Bhushan Dhodi
gourab
(Gourab Sadhukhan)
5
Hi @bhushan008 ,
Static transform might support it, as it uses velocity template.
This will do what you are looking to achieve. Just change the values accordingly
{
"name": "Transform",
"type": "static",
"attributes": {
"value": "#if ($function.contains('*value*'))true#{else}false#end",
"function": {
"type": "firstValid",
"attributes": {
"values": [
{
"type": "accountAttribute",
"attributes": {
"attributeName": "*attributeName*",
"sourceName": "*sourceName*"
}
},
"xxx"
]
}
}
}
}
Phil
2 Likes
@bhushan008 You can also try something like this:
{
"name": "Compare String TRN",
"type": "static",
"attributes": {
"FristString": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "Test Source",
"attributeName": "FristAttribute"
},
"type": "accountAttribute"
},
"None"
]
},
"type": "firstValid"
},
"SecondString": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "Test Source",
"attributeName": "SecondAttribute"
},
"type": "accountAttribute"
},
"None"
]
},
"type": "firstValid"
},
"value": "#if($SecondString != 'None' && $FristString != 'None' && $SecondString.contains($FristString))True#{else}False#end#"
},
"internal": false
}
2 Likes
sup3rmark
(Mark Corsillo)
9
you can’t import libraries in a transform 
1 Like
system
(system)
Closed
10
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.