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

built in service which gives the last 4 characters of a string

  • 1.  built in service which gives the last 4 characters of a string

    Posted Fri February 10, 2006 09:40 PM

    hi experts,
    can anybody tell me if there is any built in service which we can call and give it a string input while it gives me the last four digits of that string as output.
    example :
    string input :- filename:0001
    string output:-0001
    i just need the number out of it ,
    and the input string is the file name which i get from a polling directory.
    i use
    pub.flow:getTransportInfo, to get the file name.
    thanks
    srikanth


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


  • 2.  RE: built in service which gives the last 4 characters of a string

    Posted Fri February 10, 2006 10:17 PM

    If you string has (:slight_smile: always in the filename as you mentioned use pub.string:tokenize (set delmiter :)then extract the index[1] from valueList output map it to a new string gives 0001

    HTH,
    RMG


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


  • 3.  RE: built in service which gives the last 4 characters of a string

    Posted Sun February 12, 2006 09:54 PM

    Shrikath,

    You can use a combination of two built-in services to achieve your goal. Lets say your input string is in the variable named “filename”. First use pub.string:length to get the length of the filename in a variable “len”, then use pub.string:substring to get the last 4 chars of the filename. When using the substring service map your filename to the inString, len-4 to beginIndex and len to endIndex.

    HTH, Rohit


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