A bit of confusion about the split (string regex) method for string classes in Java
This class is described in the JDK Chinese API as follows:
Public string[] split(String regex)
Splits this string according to the match of the given regular expression.
The method acts as if the two-parameter split method is invoked using the given expression and the constraint p
String [] Split (string RegEx)
Split this string based on the matching of the given regular expression. "//" is required for the RegEx symbol in Java, because RegEx uses "/" as the escape character. In Java, a "/" must be represented.
If "." is used for segmentation, it
can only enter Chinese
/**
* 22. Verify Chinese character
* Expression ^[\u4e00-\u9fa5]{0,}$
* Describe only Chinese characters
* Matching example qingqing Moon * * *
@Test public
void A1 () {
Scanner sc = new Scanner (system.in);
String input = Sc.nextline ();
String regex = "^[\\u4e00-\\u9fa5]*$";
Matcher m = pattern.compile (regex). Matcher (input);
System.out.println (M.find ());
Sc.
First, a demo programJava's regular expression package is Java.util.regex, mainly using the pattern and matcher.The GroupCount method is callable, and most methods must be called after the match attempt succeeds.The main methods are:Boolean find ()The Boolean value returned indicates whether a match can be found, and if there are multiple calls, try a new match each time after the last matching position.public class Regex {public static void Main (
. Then the Matches () is called on the Matcher instance. The matches () returns true if the regular expression matches the text, and False if not.
Can do a whole lot the Matcher class. The rest is covered throughout the rest of this tutorial. Thepattern class is covered separately in my Java Regex pattern tutorial. Creating a Matcher
Creating a Matcher is done by via the Matcher () method into the pattern
The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than 0, the pattern will be applied up to n-1 times, the length of the array will not be greater than N, and the last item of the array will contain all inputs that exceed the last matching delimiter. If n is not positive, then the pattern will be applied as many times as possible, and the array can be any length. If n is 0, then the pattern w
Java basics-Learn from the context (01) and learn from the context of java
1. myeclipse is an eclipse plug-in. Developed in java. The process is javaw.exe -- started in non-command line mode.
2. companies that use these terms are often world-class and good companies. (Tec
Learn Java-6 from scratch. Execute operations repeatedly using loops and learn java-6
1. Use the for loop;
2. Use the while loop;
3. Use the do-while loop;
4. Early exit loop (break, continue );
5. Name the loop.
Program Nines: display the product of integers 1-and 9
1 package com.jsample; 2 3 public class Nines { 4
Java is used to do the project! Java's main area of application is enterprise-level project development! To engage in enterprise-level project development, you need to master the following points:
1, master the basic steps of project development
2, with a strong object-oriented analysis and design skills
3, master use case driven, architecture as the core of the mainstream development method
No one wants to be satisfied with their own life to mast
Xiaokang will accompany you to learn JAVA -------- simple JAVA program, java -------- java
Analyzes a simple and complete JAVA program
Example: TestJava2_1.java
01 // TestJava2_1.
and use the instanceof operator to judge that the first class that evaluates to TRUE is the one that the reference really points to.For example, the following example:Class person{}Class Student extends person{}Class Postgraduate extends student{}Class animal{}public class Instanceoftester {public static void Main (string[] args) {Instanceoftest (New Student ());}public static void Instanceoftest (person p) {Determine the True type of Pif (P instanceof postgraduate) {System.out.println ("P is a
QuoteTo learn the spring framework of the technical insider, you must master some basic Java knowledge, is the so-called "ascend will inferiority, involved in the far must from you." The following Java knowledge is closely related to the spring framework, and it's important to learn (I'll introduce these
Learn to program, learn Java or Big data, Android? There are many students in the tangle, recently there are a lot of beginners to ask, learning big data, learning Spark, the company mainly use those languages to write, every hear this question, at least it is very good, prove that you have started to learn big data, a
Can I learn java training for girls without any foundation in Wuhan? Wuhan Java female programmer's career path, Wuhan java
I,Java training in WuhanCan girls with zero base learn it?
Most people think that the IT industry in Wuhan
, the thought of making so much money, spend so many things, immediately will continue to study, this and at home drink this cola see this online free video mentality is completely inconsistent.Self -For self-studyis the control force strong enough?How do you understand your ability?Advantages: The cost of money is lower, can follow their own set of learning plans to study, time is also relatively free.Disadvantage: Self-study consumption of time is relatively long, if there is no foundation, wa
was not recruited. Later learned that he went to a company, a monthly salary of 10K, did six months, out of business, did not, to Zhengzhou toss a year, and back to Beijing, late last year to find a job, or a monthly salary of 10K. Although there is a difference between JS and the main topic of Java, his experience may still have some referential significance: 1, with interest to learn certain it skills
. The difference is that building blocks of code is used to initialize all objects uniformly, and to locate the initialization content of different object commonalities. The constructor is the initialization of the corresponding object.
This: can be used to represent a reference to the object to which the function belongs. In a nutshell, which object is calling the function where this is located, this represents which object. When defining a function in a class, the function is used interna
How to Learn Java-Java learning roadmap and java Roadmap
How to Learn Java is a problem that many new users often ask me. Now I will briefly describe some things to be learned by the next Java
QuoteTo learn the spring framework of the technical insider, you must master some basic Java knowledge, is the so-called "ascend will inferiority, involved in the far must from you." The following Java knowledge is closely related to the spring framework, and it's important to learn (I'll introduce these
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.