IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

string tokenize

  • 1.  string tokenize

    Posted Mon September 11, 2006 08:42 PM

    Hi,

    I have requirement for checking the pipe (|) and removing the third string

    like incoming string would be GB|0923774|385763 and I have to return out GB|0923774. If input is GB|0923377 then no need to take any action.

    Please let me know how to implement logic.

    Thanks and Regards,
    Akshay


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: string tokenize

    Posted Mon September 11, 2006 11:06 PM

    Akshay,

    There are more than one ways to do this, but before I jump into explaining, can you confirm that your string can have max 2 occurrences of | and you have to get rid of the string after second | or can there be multiple occurrences of pipe and you have to get rid of every third string?

    eg can your string be: GB|0923774|385763|GB|4523223|7873234
    and desired output is: GB|0923774|GB|4523223

    or will it always be only like: GB|0923774|385763 requiring output to be
    GB|0923774?

    Obviously the latter is much simpler to achieve.

    ~ Rohit


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: string tokenize

    Posted Tue September 12, 2006 01:33 AM

    Hi Rohit,

    yes my string always contain max 2 pipe.

    My input string always will be like GB|0923774|385763 or GB|0923774 and required output for both condition should be GB|0923774.

    Akshay


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: string tokenize

    Posted Tue September 12, 2006 02:13 AM

    Review the descriptions for these services.

    pub.string:tokenize
    pub.string:makeString

    You should be able to do this with just these two calls and a map step or two.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 5.  RE: string tokenize

    Posted Tue September 12, 2006 02:20 AM

    Akshay,

    Using with string:tokenize(input yourstring,delim= | returns ValueList),using map steps you can use valuelist[0,1] indexes or loop it and append them to a newstringlist and finally use string:makeString(input newstringlist,delim = |) to form GB|0923774

    This logic should work with both of your cases when input is GB|0923774|385763 or GB|0923774…

    Sorry Rob,i didnt see your post before my post which has similar suggestion and later realized.

    HTH,
    RMG


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 6.  RE: string tokenize

    Posted Tue September 12, 2006 04:55 AM

    There you have your answer Akshay - tokenize and then makeString. When mapping from valueList (result of tokenize) to makeString’s element array, set proper indices under the properties.

    ~ Rohit


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: string tokenize

    Posted Tue September 12, 2006 05:33 PM

    Thanks all it’s works !!! nice to see I registered on good active forum and all credit goes to u.


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 8.  RE: string tokenize

    Posted Wed October 17, 2007 05:27 PM

    Hi.
    I’d like to ask, how can I get stringList with three values from this one: 0035;;23 ??
    I need to get three values second should be $null, or ’ '.
    Thx.


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 9.  RE: string tokenize

    Posted Wed October 17, 2007 06:07 PM

    Write a Java service that has the same service signature as pub.string:tokenize but name it something like myutils.string:split (put it into whichever folder makes most sense for your general purpose utilities).

    Within the service, use String.split to perform the work (requires JVM 1.4 or later).


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB