Results 1 to 2 of 2
  1. #1
    neeleshust84 is offline Member
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0

    Post String tokenizer logic ..(urgent)

    Hi All,
    I need to write a logic where a string consists of 4 zeroes(0) and space and again like this.I need to return true in case if this condition fullfils otherwise if there is any other digit apart (1 to 9 ) then i need to return false.

    Regards
    Neelesh

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

    Default

    Quote Originally Posted by neeleshust84 View Post
    Hi All,
    I need to write a logic where a string consists of 4 zeroes(0) and space and again like this.I need to return true in case if this condition fullfils otherwise if there is any other digit apart (1 to 9 ) then i need to return false.

    Regards
    Neelesh
    The right strings are thus: "0000 " , or "0000 0000 " and so on ?
    or can the space be between the zeros?
    If I have understood it correctly, you could use String.matches and regex, e.g.:
    Java Code:
    	public boolean check(String s){
    		return s.matches("(0{4} )+");
    	}

Similar Threads

  1. String Tokenizer
    By sumaih in forum Java Gaming
    Replies: 2
    Last Post: 08-21-2010, 03:23 PM
  2. String Tokenizer
    By hussainian in forum Advanced Java
    Replies: 1
    Last Post: 03-16-2010, 08:58 AM
  3. String Tokenizer
    By viperlasson in forum New To Java
    Replies: 1
    Last Post: 03-09-2010, 01:14 PM
  4. String Tokenizer
    By redasu in forum Advanced Java
    Replies: 4
    Last Post: 02-19-2010, 03:30 AM
  5. string tokenizer
    By twinytwo in forum New To Java
    Replies: 2
    Last Post: 03-26-2009, 02:10 PM

Posting Permissions

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