• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pattern Matching in antique 1.3 compiler  RSS feed

 
Affan Portals
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't use Regex! I need to find out if a given string a valid decimal number. What i have thought of is to create a switch statement representing 0-9, a (.) for decimal. Is that the best way to do it? I also can't use apache String Utils!
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One ugly way, but at least it works, it to try to parse the number and catch the NumberFormatException:
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jregex is a nice little regexp package that runs in older JVMs, including 1.3. I've been using it for years before switching to java.util.regex, and have been quite happy with it.
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also ORO will work. an open source regex engine...

http://jakarta.apache.org/oro/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!