java-Basics (v) More tools set

Source: Internet
Author: User

1.StringTokenizer (String tag)

StringTokenizer implements an enumeration (enumeration) interface. Therefore, given an input string, you can use StringTokenizer to enumerate the individual tags contained therein. When you use StringTokenizer, you specify an input string and a string that contains a separator. The separator (delimiters) is the character of the split tag. Each character in the delimiter string is treated as a valid separator

The StringTokenizer constructor is as follows: StringTokenizer (String str) StringTokenizer (string str, string delimiters) StringTokenizer ( String str, string delimiters, Boolean Delimastoken) in the above three forms, str represents the string to be tagged. In the first form, the default separator is used. In the second and third forms, delimiters is a string used to specify the delimiter. In the third form, if Delimastoken is true, the delimiter is also returned as a token when the string is parsed, otherwise the delimiter is not returned. In the first and second forms, the separator is not returned as a marker. Once the StringTokenizer object has been created, the NextToken () method is used to extract successive tokens. The Hasmoretokens () method returns True when there are more tokens being extracted. Because StringTokenizer implements enumerations (enumeration), the hasMoreElements () and Nextelement () methods are also implemented, and their role is also different from Hasmoretokens () Same as the Nexttoken () method

java-Basics (v) More tools set

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.