Jump to content

Is there any way to convert Smallcase string to Titlecase/Camelcase in BW6/BWCE?


Akash Awad 2

Recommended Posts

  • 4 weeks later...

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

×
×
  • Create New...