webMethods

webMethods

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 manipulation & flow language

  • 1.  String manipulation & flow language

    Posted Mon March 25, 2002 09:52 AM

    How flexible is the flexible is the Flow language with regard to string manipulation. Lets say the
    input to the service is a String. I need to loop
    through this string and insert a delimiter after
    every 35 characters until the end of the string.
    How would I do this using only the flow constructs and
    built-in services? I do not want to write a java program/service to do this.


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 2.  RE: String manipulation & flow language

    Posted Mon March 25, 2002 02:37 PM

    There are many ways to do this. Off the top of my head:

    -Repeat (while success)

    -Get the input String length
    
    -Branch
    -exit loop if strlen < 35
    
    -map (break the string into 2 parts using 2 substring transformers - the two parts are the first 35 and the rest of the string. assign the 2nd part to the original input string)
    
    -concatenate the first 35 character to the output string
    
    - concatenate the delimiter to the output string
    

    -append any leftover chars to the output string: Note that this last step is outside of the repeat loop


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: String manipulation & flow language

    Posted Mon March 25, 2002 02:42 PM

    Your best bet is probably to use the built in pub.string:substring and pub.string:concat within your loops (and the neccessary branches on the length of the string, etc).

    The only thing is it will be VERY inefficient to use a flow service when you get into parsing large strings. Unless there you cannot use java services under any circumstances, I would suggest writing this in java. That way you can use StringBuffers and more ‘native’ java string manipulation.


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods