Tag:White space

  • Determine whether the string and object are empty


    Stringutils provides two common methods for judging empty stringsisEmptyandisBlank public static boolean isEmpty(String str) To determine whether a string is empty, the standard is strNull or str.length ()0Here is an example: StringUtils.isEmpty (null) = trueStringUtils.isEmpty (“”) = true StringUtils.isEmpty (‘) = false // note that spaces are not null in stringutils StringUtils.isEmpty (” “) = […]

  • Java common class: scanner class


    1、 Introduction java.util.Scanner It’s a new feature of Java 5. We can use the scanner class toGet user input。 2、 Creating objects Example: Scanner scanner = new Scanner(System.in); 3、 Common methods I. getting input method: next(): get the next input string. nextLine(): gets the string entered by the user on the next line. The difference […]

  • Collation of common regular expressions


    Common regularization Some regularities can’t guarantee the exact match, just for reference. Website URL^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+ phone number0?1[2-8][0-9]{9} mailbox\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14} Domestic phone number[0-9-()()]{7,18} ID number\d{17}[\d|x]|\d{15} date\d{4}(\-|\/|.)\d{1,2}\ Chinese characters[\u4e00-\u9fa5] Chinese characters and symbols[^\x00-\xff] IP address (25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d) Common metacharacters code explain . Matches any character except newline \w Match letters or numbers or underscores \s Matches any white space \d […]