• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NX: null and blank string process

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I got one problem when processing the null and blank string(""). for example, when writing into the file, how to differ them, and while reading out the record, how to differ them?
Please help!
Best regards!
Frank
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi frank,
I really could not understand what u exactly mean by null and String("").
null string basically is the string that coes not have any data like String(""). Internally it is represented as char[] data = new char[0];
where as null is something else, a state where the object is not created.
In the assignment, null terminated string represents String(""). So please do not confuse.
After u read the data from db file, just trim the extra spaces, and while writing to the db file, pad the speces to the maximum lenght of that field.
Ganapathy
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it's null right something like 'NULL' to the file and when you're reading check for this before initialazing any data.
 
frank sun
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank at first.
Let me make my question clear.
before inserting a new record into the data file, it needs to check if there already exists the duplicated record, eg, it needs to insert the record, the string array values like("a","","","d"); and in the data file, there has one record like, the string array values is,("a","",null,"d"), so, do I need to take them as the duplicated record? (and when writing the record data into the data file, should all the null values in the record data be regarded as ""?)
Thanks!
Frank
reply
    Bookmark Topic Watch Topic
  • New Topic