Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7402145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:40:11+00:00 2026-05-29T04:40:11+00:00

I’m working with beanshell to parse SWIFT data and need to extract values by

  • 0

I’m working with beanshell to parse SWIFT data and need to extract values by referencing these SWIFT tags. Right now, I statically get these values as such:

String getACRU = swiftMessage.getTagData("19A",":ACRU//");
String getANTO = swiftMessage.getTagData("19A",":ANTO//");
String getCHAR = swiftMessage.getTagData("19A",":CHAR//");
String getCOUN = swiftMessage.getTagData("19A",":COUN//");
String getEXEC = swiftMessage.getTagData("19A",":EXEC//");
String getISDI = swiftMessage.getTagData("19A",":ISDI//");
String getLADT = swiftMessage.getTagData("19A",":LADT//");
String getLEVY = swiftMessage.getTagData("19A",":LEVY//");
String getLOCL = swiftMessage.getTagData("19A",":LOCL//");
String getLOCO = swiftMessage.getTagData("19A",":LOCO//");
String getMARG = swiftMessage.getTagData("19A",":MARG//");
String getOTHR = swiftMessage.getTagData("19A",":OTHR//");
String getPOST = swiftMessage.getTagData("19A",":POST//");
String getREGF = swiftMessage.getTagData("19A",":REGF//");
String getSHIP = swiftMessage.getTagData("19A",":SHIP//");
String getSPCN = swiftMessage.getTagData("19A",":SPCN//");
String getSTAM = swiftMessage.getTagData("19A",":STAM//");
String getSTEX = swiftMessage.getTagData("19A",":STEX//");
String getTRAN = swiftMessage.getTagData("19A",":TRAN//");
String getTRAX = swiftMessage.getTagData("19A",":TRAX//");
String getVATA = swiftMessage.getTagData("19A",":VATA//");
String getWITH = swiftMessage.getTagData("19A",":WITH//");
String getCOAX = swiftMessage.getTagData("19A",":COAX//");
String getACCA = swiftMessage.getTagData("19A",":ACCA//");

My question is two-fold: what’s the best way to elegantly rewrite this and what is the best way in beanshell to add a method/function that would remove the first three characters, change the comma to a period and once all those values have been parsed out of the message, to add them all up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:40:12+00:00Added an answer on May 29, 2026 at 4:40 am

    It seems that this worked quite well. Store all the values I need in an array:

    String [] tagArray = new String [] { ":ACRU//",":ANTO//",":CHAR//",":COUN//",":EXEC//",":ISDI//",":LADT//",":LEVY//",":LOCL//",":LOCO//",":MARG//",":OTHR//",":POST//",":REGF//",":SHIP//",":SPCN//",":STAM//",":STEX//",":TRAN//",":TRAX//",":VATA//",":WITH//",":COAX//",":ACCA//" };
    

    And create a function to loop and add:

    double sumTags(SwiftMessage inboundSwiftmessage, String inboundTagNumber, String [] inboundTagArray){
      double getTotal;
      for( tagArrayData : inboundTagArray ){
        String getData = stripData(inboundSwiftmessage.getTagData(inboundTagNumber,tagArrayData));
        getTotal = getTotal + Double.parseDouble(getData);
      }
      return getTotal;
    }
    

    And this is the function to remove the first 3 characters and convert, then remove, the comma into a period:

    String stripData(String inboundString){
      if (inboundString==null){
        return "0";
      }
      else
      {
        char strippedString;
        StringBuffer strippedBuffer = new StringBuffer("");
        char [] inboundArray = inboundString.toCharArray();
        for (int counter = 3 ; counter < inboundArray.length; counter++)
        {
          strippedString = inboundArray[counter];
          strippedBuffer.append(strippedString);
        }
        return strippedBuffer.toString().replace(",",".");
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I need to clean up various Word 'smart' characters in user input, including but
i want to parse a xhtml file and display in UITableView. what is the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.