Akash Awad 2 Posted November 1, 2023 Share Posted November 1, 2023 I have tried using replace function and regexreplace($Invoke/parameters/tns1:getCustomerDBResponse/first_name, "(^[a-z]| [a-z])", "\U$1")but it did not worked Link to comment Share on other sites More sharing options...
Julio Gimenes 2 Posted November 28, 2023 Share Posted November 28, 2023 Hello @Akash Awad !If the element '$Invoke/parameters/tns1:getCustomerDBResponse/first_name' returns only the 'first_name', for example [jane, john], you can use the function below to perform camel case transformation. If the result of this transformation is [Jane, John].tib:trim(concat(upper-case($first_name, 1, 1)), $first_name, 2, string-length($MapperInputData/tns:user[1]/tns:name) - 1)))If the elements consist of compound names, such as [Jane Doe, John Doe], you can achieve this transformation using the Transform XML activity. An example of this can be found in XSLT at the following link.An alternative approach involves utilizing Java within a Java Invoke activity or Custom Functions. Below is an example of the code. public static String convertToCamelCase(String input) { Pattern pattern = Pattern.compile("\b\w"); Matcher matcher = pattern.matcher(input); StringBuffer result = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(result, matcher.group().toUpperCase()); } matcher.appendTail(result); return result.toString(); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now