Sunday, 20 October 2013

Talend - Convert string to integer (Integer.parseInt())



Talend - Convert string to integer (Integer.parseInt())

At times you might have a need to convert string to integer in your job. This need could be because of some integer value which you had saved in global variable in talend using globalMap.put() and you need this conversion when you fetch this back using globalMap.get().

One possible way of doing this conversion is as below using java code

String sNum = "10";
int i = Integer.parseInt(sNum);
System.out.println("String value is - "+sNum);
System.out.println("Integer value is - "+i);



7 comments:

  1. Hi article is realy nice, i will suggest alternative method for parsing using java8, wecan use these methods in parsing like,
    1. Set.Stream()
    2.Steam.map()
    3. Collectorts.toset() it is the best way to convert string to int i hope this may be use full.

    ReplyDelete