WSO2 Data Mapper Operators - String category
This post describes about the operators in the String category
- Concat
This can be used to concat two or more string values
1.Drag and drop the operator to the editor
1.Drag and drop the operator to the editor
Eg: name and the origin will concat using the delimiter “,” and maps the result to the description
- Split
This can be used to split a string value using a specified delimiter
Eg: if the oring value is “French:FR” the the split the origin from “:” and map the ‘French’ and ‘FR’ to origin and value fields
- Uppercase
This can be used to convert a string value to uppercase
- Lowercase
This can be used to convert a string value to lowercase
- String Length
This can be used to get the length of a string
- StartsWith
This can be used to check whether a String starts with a specific value ( This is not supported in Java 7)
Eg: if the origin value if ORI-French, then we can check if it’s starts with ‘ORI’
1.Drag and drop the operator to the editor
2. You can give the String value you need to check into the first input box and the string pattern to the other input box. String pattern can be given in two ways as below
-Can give via the dialog box by right click and select “Configure StartsWith operator” menu action and then specify the pattern at {$Pattern}
-Can give as an input to the operator either using another operator as shown below or using the input value from the data mapper input tree
- Endswith
This can be used to check whether a String ends with a specific value. ( This is not supported in Java 7)
(Works similar to the startsWith operator)
- SubString
This can be used to extracts a part of the String value
Eg: if the description is “VEG-Vegetarian”, then we can extract the VEG part and maps the value
1.Drag and drop the operator to the editor
2. You can give the String value into the first input box and the start index and the length to the other two input boxes. Those can be given in two ways as below
-Can give via the dialog box by right click and select “Configure SubString operator” menu action and then specify the start {$Index} and {$Length}
-Can give as an input to the operator either using two other operators as shown below or using the input values from the data mapper input tree
- Trim
- Replace
This can be used to replace the first occurrence of a target String with another
Eg: if the description is “Ctg:Vegetarian”, then we can replace Vegetarian with VEG and maps the value
1.Drag and drop the operator to the editor
2. You can give the String value into the first input box and the target string and the replace with string to the other two input boxes. Those can be given in two ways as below
-Can give via the dialog box by right click and select “Configure Replace operator” menu action and then specify the {$Target} and {$Replace}
-Can give as an input to the operator either using two other operators as shown below or using the input values from the data mapper input tree
- Match
This can be used to check whether the input match with a (JS) Regular Expression
1.Drag and drop the operator to the editor
2. You can give the String value into the first input box and the pattern the other input box. The pattern can be given in two ways as below
-Can give via the dialog box by right click and select “Configure Match operator” menu action and then specify the {$Pattern}
-Can give as an input to the operator either using another operator as shown below or using the input values from the data mapper input tree
Really nice blog and impressive information you gave us.Thank you and i will expect more in future.
ReplyDeleteJAVA Training in Chennai
JAVA Course in Chennai
Big data training in chennai
Software testing training in chennai
Selenium Training in Chennai
Python Training in Chennai
JAVA Training in Chennai
Java Training in Anna Nagar