Java programming notes 5: stringbuffer and stringtokenizer

Source: Internet
Author: User

Character character

The character class is used to store and operate a single character value, once character

If an object is created, it cannot be changed.

 

Constructor Summary

Character(Char value)
Constructs a new character object to represent the specified char value.

Common Methods:

Int

Compareto(Character anothercharacter)
Compare two character Objects Based on numbers.

Boolean

Equals(ObjectOBJ)
Compare this object with the specified object.

String

Tostring()
Returns a String object that represents the character value.

Char

Charvalue()
Returns the value of this character object.

 

4. String tag class stringtokenizer

The string class provides the split method to separate strings and return a string array. In fact, there is a special string tag class stringtokenizer used to separate strings in Java.

Constructor Summary

Stringtokenizer(String Str)
Constructs a string tokenizer for the specified string.

Stringtokenizer(String STR, string delim)
Constructs a string tokenizer for the specified string.

Stringtokenizer(String STR, string delim, Boolean returndelims)
Constructs a string tokenizer for the specified string.

Delim is the delimiter.

Method Summary

Int

Counttokens()
Count the number of times the tokenizer nexttoken method can be called before an exception is generated.

Boolean

Hasmoreelements()
Returns the same value as the hasmoretokens method.

Boolean

Hasmoretokens()
Test whether there are more available tags in the tokenizer string.

Object

Nextelement()
Except that the declared return value is an object rather than a string, it returns the same value as the nexttoken method.

String

Nexttoken()
Returns the next tag of the string tokenizer.

String

Nexttoken(String delim)
Returns the next tag in the string of this string tokenizer.

Pay attention to the return type.

Refer to: Java getting started and improving, Chapter 5 string processing, read the code examples, and sort out common methods.

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.