Topic
3 replies Latest Post - ‏2010-06-29T18:50:14Z by Kinow
POWERBUILDER
POWERBUILDER
3 Posts
ACCEPTED ANSWER

Pinned topic empty space problem

‏2010-02-03T17:13:28Z |
Please see file attached for problem's description
Updated on 2010-06-29T18:50:14Z at 2010-06-29T18:50:14Z by Kinow
  • Hasene
    Hasene
    2 Posts
    ACCEPTED ANSWER

    Re: empty space problem

    ‏2010-06-12T03:55:13Z  in response to POWERBUILDER
    I really didnt get your question properly.

    But if the validation of empty space is your problem, then you can use the condition,
    if(fieldname.length()!=0 && fieldname != null)
    {
    do any operation with field
    }
    • Hasene
      Hasene
      2 Posts
      ACCEPTED ANSWER

      Re: empty space problem

      ‏2010-06-12T04:25:02Z  in response to Hasene
      if(fieldname.trim().length()!=0 && fieldname != null)
      {
      Search
      }
      this may be a better answer for your query.
      • Kinow
        Kinow
        1 Post
        ACCEPTED ANSWER

        Re: empty space problem

        ‏2010-06-29T18:50:14Z  in response to Hasene
        Hey there,

        quite old post. I didn't understand your problem either. However I agree that you should do something like Hasene proposed.

        The only point is that the code:

        if(fieldname.trim().length()!=0 && fieldname != null)
        {
        Search
        }

        Might throw NullPointerException if the fieldname is null. You have to swap the order of the boolean expressions.

        if( fieldname != null && fieldname.trim().length()!=0)
        {
        Search
        }

        Btw, in case you're using Swing as GUI API, perhaps you could google for ready-to-use Swing components with embedded validation. I used one once, I think it was part of JGoodies Open Source applications.

        Cheers,
        Bruno