• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

How to Set Array in Value 3

 
Ranch Hand
Posts: 39
IBM DB2 jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Team,

I have a ini file
this is the format.
%F[ACCTTYPECD|ACMAST|ACCTNO=AAF12236|COMPANYID=1]/.csv

remarks:
After value 3 will not fix, may be have add 2 value or above..


value 1 (ACCTTYPECD) = field
Value 2(ACMAST) = table
after value 3 is condition

the ini file value will detect in servlet...
at servlet there i have write


how to write coding after value 3 in array in java?
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you please elaborate your question little more.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Couple of comments on the code:

This logic looks wrong:


Because value3 is "F", it will never have a '|' character in it.
Can you explain what "value3" is? Maybe give that variable a better name.


- You have set up a loop through all the elements in your parts array. Then within that loop, you refer to the elements within the parts array by index.
You should do one or the other. Either loop through the elements in the array doing the same to each one, OR refer to elements by their index.
As it is, it looks like you will be doing the same logic multiple times unnecessarily.

If I understand your point, the first two entries on the line have special meaning, the remaining ones (however many there are) can presumably all be dealt with in the same manner.
In that case I would use code something like:


>
 
Rancher
Posts: 4888
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the purpose of the for loop on line 7? The statements inside the for loop explicitly access elements in the part array? The variable str is ignored until line 16.

You need to add some comments to that section of code describing what the for loop is for and what the statements inside of the for loop are trying to do.
 
Sharon Wong
Ranch Hand
Posts: 39
IBM DB2 jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Stefan Evans. Your commend already solve my issue.

Thanks all for commend. Sorry, my poor english already giving trouble for you.

Thanks and Best regards
Sharon
 
Marshal
Posts: 76419
365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stefan Evans wrote:. . .
. . .

Another thing is that you should not use | on its own in a regex. The pipe character | is a metacharacter so it must be escaped to "\\|" if you want it as a regex. You can read what it means in the Java™ Tutorials.
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic