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
  • 1.  Remove empty space from tags and fields

    Posted Wed March 12, 2003 07:44 PM

    Hello all,

    In SAP Business Connector 4.6 I have tags and fields with
    “surplus” of empty spaces which I want to remove. How I can
    do that?
    Number of empty spaces is dynamic. Tag names are dynamic.
    example:
    I have:

    {name 1 } value 1 {/name1 }
    {name 2 } {/name2 }

    I would like to get

    “{name 1}value 1{/name1}”
    “{name 2}{/name 2}”

    TIA

    Gordan


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


  • 2.  RE: Remove empty space from tags and fields

    Posted Wed March 12, 2003 07:44 PM

    Gordon,

    Try pub.string:trim built-in service to trim spaces on both
    ends. This may not help your situation since your tags are
    dynamic though.


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


  • 3.  RE: Remove empty space from tags and fields

    Posted Wed March 12, 2003 09:46 PM

    One thing I did for that is to convert your document to an XML string and parse it to remove the desired charaters. Once the necessary work is done reload it in your record.


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


  • 4.  RE: Remove empty space from tags and fields

    Posted Fri November 18, 2005 12:33 PM

    Hello Every body

    Iam Currently Using WM:Public:String.trim function in our developemnt but the Strange thing is it trim frist and last spaces only what happend to the middle spaces. for Example Iam giving input to the string like “Raj kanth” my desire output is “Rajkanth” but it is coming as it is.
    other than Java custom code any alternative Solution and One more question why trim is taking first and last spaces only.
    Thanks in Advance
    Regards
    Sreekanth


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


  • 5.  RE: Remove empty space from tags and fields

    Posted Fri November 18, 2005 02:20 PM

    Hi Sreekanth,

    Without using a Java service , the alternate way is to create a flow service to remove spaces in the input string. The logic to be put is pretty simple. You find the length of the string and you start from the first character till last character.Unless and until you find a space keep pushing each character to a temporary output variable and if you find a space discard it.

    Regards,
    Somu


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


  • 6.  RE: Remove empty space from tags and fields

    Posted Sat November 19, 2005 12:16 AM

    sreekanth: please don’t cross-post. It is unnecessary.


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


  • 7.  RE: Remove empty space from tags and fields

    Posted Wed November 23, 2005 05:21 PM

    Sreekanth,
    You can use the pub.string:replace service instead. search for “spaces” and replace by “nothing”.

    This should work.

    Shantanu


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