Search:

Type: Posts; User: Inked.

Search: Search took 0.27 seconds.

  1. Replies
    15
    Views
    1,081

    [SOLVED] Re: Enforcing a format on a string?

    Great, I got it. Thank you.
  2. Replies
    15
    Views
    1,081

    [SOLVED] Re: Enforcing a format on a string?

    The errors are:


    Employee.java:105: error: ')' expected
    if(num.charAt(0.isDigit()) && num.charAt(1.isDigit()) && num.charAt(2).isDigit()) && num.charAt(3) = "-")
    ^...
  3. Replies
    15
    Views
    1,081

    [SOLVED] Re: Enforcing a format on a string?

    Right.

    Here's what I have so far


    if(num.charAt(0.isDigit()) && num.charAt(1.isDigit()) && num.charAt(2).isDigit()) && num.charAt(3) = "-")
    {
    status = false;
    }
    ...
  4. Replies
    15
    Views
    1,081

    [SOLVED] Re: Enforcing a format on a string?

    It is enough to say that there is an error in the string. It shall throw an exception if there is that explains to the user the correct format that needs to be entered if they enter it wrongly...
  5. Replies
    15
    Views
    1,081

    [SOLVED] Re: Enforcing a format on a string?

    So should I have 3 separate if statements? One for each of the things I'm checking? How could I go about doing this? (I haven't had much experience with this kind of issue until recently).
  6. Replies
    15
    Views
    1,081

    [SOLVED] Re: Enforcing a format on a string?

    I can code a loop/if to do the validation, mostly. I just worry with that because, if I were to do Character.isDigit at the index, wouldn't it throw my exception once it got to the - or the B,...
  7. Replies
    15
    Views
    1,081

    [SOLVED] Re: Enforcing a format on a string?

    The string will be created based on user input, I'll ask them for them to enter it with a reminder of the format. However; as much as I can tell the user it has to be in that format, I need to create...
  8. Replies
    15
    Views
    1,081

    [SOLVED] Enforcing a format on a string?

    Alright, so let's say I have this string. I want to make it so that the string for this variable has to follow a certain format.

    For example, "AAA-B", where the A's are a digit 0-9, the - is...
Results 1 to 8 of 8