Javascript  
 
  ScriptJava  
 
  Perl  
 
  PHP  
 
  ROR  
 
  ask us  
 

 

Applications
  1. Getting started
  2. Definitions
  3. First program
  4. Characters and Strings
  5. Object and methods
  6. Arrays and Circles
  7. Exceptions
  8. The main method
  9. Reading
  10. Writing file
  11. Vectors
  12. Stacks
  13. Map The Dictionary
  14. Lists
  15. Linked lists
  16. Collection
  17. Interfaces
  18. Scanner
  19. StringTokenizer
  20. Generics
  21. JDBC
  22. DataBase Queries
  23. JSP, The main step

Graphics

Applets
  1. Regards
  2. One Picture
  3. Calculator
  4. Random pictures
  5. Bouncing picture

Swings
  1. Buttons listeners
  2. TextFields
  3. Swing Example

JavaBeans
  1. The first step
  2. Example

Search a word:
   



© The scientific sentence. 2010

StringTokenizer
StringTokenizer

/**
1. StringTokenizer

The class StringTokenizer extends from  java.util that extends 
from java.lang.Object. It emplements from Enumeration class. The 
main purpose of the StringTokenizer is to parse a set of string 
(as a sentence) into separated strings (tokens).

The related main code is the following:
    
StringTokenizer st = new StringTokenizer("All the best of luck");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
}

The constructors of the class StringTokenizer are:
public StringTokenizer(String str) or
public StringTokenizer(String str, String delimiter) or
public StringTokenizer(String str, String delimiter, boolean 
returnDelimiters)	

The delimiter arguments are used to separate tokens.
The delimiters characters are also returned as tokens if the 
returnDelims flag is true. Each delimiter is returned as a string 
of length one. If the flag is false, the delimiter characters are 
skipped and only serve as separators between tokens.

A token consists of one or more characters of which none are 
blanks, control characters, or characters within a string constant 
or delimited identifier. Tokens are ordinary (like letters and numbers) 
or delimiter tokens (like operators and marks)

2. Example:		  
*/	
	  
import java.util.StringTokenizer;
public class TheStringTokenizer {

public static void main(String[] args) {
//Create StringTokenizer fresh object
    StringTokenizer str = new StringTokenizer("Regards! 
	and - All, The % best & of ? luck", "%", true);
 //Moving on through tokens by iteration
    while(str.hasMoreTokens())
      System.out.println("\n\t" + str.nextToken("%"));

  }
}

/*
Execution:
----------
C:\Java>javac TheStringTokenizer.java
C:\Java>java TheStringTokenizer

   Regards! and - All, The
   %   
   best & of ? luck

*/


  
Google
Web
ScientificSentence
 




chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2009. All rights reserved.