public class TestLineForDigit { public static void main(String[] args) { String linePattern = "5 B+ tree. Because in B+ tree, all the data is stored only in leaf nodes."; if (linePattern.matches("\\d.*")) System.out.println("true"); // print true if line found any [0-9] number in beginning else System.out.println("false"); // print false if expression does not match start digit value } }
Monday 27 May 2013
Check if line starts with a number in java using regex
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment