Results 1 to 3 of 3
  1. #1
    mr.ab18 is offline Member
    Join Date
    Aug 2010
    Posts
    4
    Rep Power
    0

    Default Help with regular expression

    I wanna execute regular expression on char that is user input a char and the program returns its decimal. How to use regular expression on char such that is char input is e.g T then output error. How to use regular expression on char ???








    package hexaDecimal;

    import java.util.regex.Pattern;

    public class HexaDecimal {
    char ch;

    public HexaDecimal(){

    ch = '\0';




    }
    public void setDigit(char digit){ // What regular expression will cum ?
    Pattern pattern = pattern.compile(digit);
    ch = digit;
    }
    public int getDecimalValue(){




    }
    }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,725
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by mr.ab18 View Post
    I wanna execute regular expression on char that is user input a char and the program returns its decimal.
    You don't need regular expressions for that; the Character class has the method(s) you want. Read the API documentation for that class.

    kind regards,

    Jos

  3. #3
    akther is offline Member
    Join Date
    Aug 2010
    Posts
    3
    Rep Power
    0

Similar Threads

  1. regular expression
    By prof.deedee in forum JDBC
    Replies: 3
    Last Post: 02-19-2010, 12:15 PM
  2. regular expression
    By QkrspCmptPop in forum Advanced Java
    Replies: 8
    Last Post: 01-20-2010, 04:55 AM
  3. regular expression
    By ras_pari in forum Advanced Java
    Replies: 27
    Last Post: 10-07-2009, 01:25 PM
  4. Complex Regular Expression HELP
    By hiklior in forum New To Java
    Replies: 1
    Last Post: 04-30-2008, 02:52 PM
  5. Regular Expression Challange
    By hiklior in forum New To Java
    Replies: 2
    Last Post: 04-24-2008, 06:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •