API java : StringCharacterIterator


java.text
Class StringCharacterIterator

java.lang.Object
  extended by java.text.StringCharacterIterator
All Implemented Interfaces:
Cloneable, CharacterIterator

public final class StringCharacterIterator
extends Object
implements CharacterIterator

StringCharacterIterator implements the CharacterIterater protocol for a String. The StringCharacterIterator class iterates over the entire String.

See Also:
CharacterIterator

Field Summary
 
Fields inherited from interface java.text.CharacterIterator
DONE
 
Constructor Summary
StringCharacterIterator(String text)
          Constructs an iterator with an initial index of 0.
StringCharacterIterator(String text, int pos)
          Constructs an iterator with the specified initial index.
StringCharacterIterator(String text, int begin, int end, int pos)
          Constructs an iterator over the given range of the given string, with the index set at the specified position.
 
Method Summary
 Objectclone()
          Creates a copy of this iterator.
 charcurrent()
          Implements CharacterIterator.current() for String.
 booleanequals(Object obj)
          Compares the equality of two StringCharacterIterator objects.
 charfirst()
          Implements CharacterIterator.first() for String.
 intgetBeginIndex()
          Implements CharacterIterator.getBeginIndex() for String.
 intgetEndIndex()
          Implements CharacterIterator.getEndIndex() for String.
 intgetIndex()
          Implements CharacterIterator.getIndex() for String.
 inthashCode()
          Computes a hashcode for this iterator.
 charlast()
          Implements CharacterIterator.last() for String.
 charnext()
          Implements CharacterIterator.next() for String.
 charprevious()
          Implements CharacterIterator.previous() for String.
 charsetIndex(int p)
          Implements CharacterIterator.setIndex() for String.
 voidsetText(String text)
          Reset this iterator to point to a new string.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringCharacterIterator

public StringCharacterIterator(String text)
Constructs an iterator with an initial index of 0.


StringCharacterIterator

public StringCharacterIterator(String text,
                               int pos)
Constructs an iterator with the specified initial index.

Parameters:
text - The String to be iterated over
pos - Initial iterator position

StringCharacterIterator

public StringCharacterIterator(String text,
                               int begin,
                               int end,
                               int pos)
Constructs an iterator over the given range of the given string, with the index set at the specified position.

Parameters:
text - The String to be iterated over
begin - Index of the first character
end - Index of the character following the last character
pos - Initial iterator position
Method Detail

setText

public void setText(String text)
Reset this iterator to point to a new string. This package-visible method is used by other java.text classes that want to avoid allocating new StringCharacterIterator objects every time their setText method is called.

Parameters:
text - The String to be iterated over
Since:
1.2

first

public char first()
Implements CharacterIterator.first() for String.

Specified by:
first in interface CharacterIterator
Returns:
the first character in the text, or DONE if the text is empty
See Also:
CharacterIterator.first()

last

public char last()
Implements CharacterIterator.last() for String.

Specified by:
last in interface CharacterIterator
Returns:
the last character in the text, or DONE if the text is empty
See Also:
CharacterIterator.last()

setIndex

public char setIndex(int p)
Implements CharacterIterator.setIndex() for String.

Specified by:
setIndex in interface CharacterIterator
Parameters:
p - the position within the text. Valid values range from getBeginIndex() to getEndIndex(). An IllegalArgumentException is thrown if an invalid value is supplied.
Returns:
the character at the specified position or DONE if the specified position is equal to getEndIndex()
See Also:
CharacterIterator.setIndex(int)

current

public char current()
Implements CharacterIterator.current() for String.

Specified by:
current in interface CharacterIterator
Returns:
the character at the current position or DONE if the current position is off the end of the text.
See Also:
CharacterIterator.current()

next

public char next()
Implements CharacterIterator.next() for String.

Specified by:
next in interface CharacterIterator
Returns:
the character at the new position or DONE if the new position is off the end of the text range.
See Also:
CharacterIterator.next()

previous

public char previous()
Implements CharacterIterator.previous() for String.

Specified by:
previous in interface CharacterIterator
Returns:
the character at the new position or DONE if the current position is equal to getBeginIndex().
See Also:
CharacterIterator.previous()

getBeginIndex

public int getBeginIndex()
Implements CharacterIterator.getBeginIndex() for String.

Specified by:
getBeginIndex in interface CharacterIterator
Returns:
the index at which the text begins.
See Also:
CharacterIterator.getBeginIndex()

getEndIndex

public int getEndIndex()
Implements CharacterIterator.getEndIndex() for String.

Specified by:
getEndIndex in interface CharacterIterator
Returns:
the index after the last character in the text
See Also:
CharacterIterator.getEndIndex()

getIndex

public int getIndex()
Implements CharacterIterator.getIndex() for String.

Specified by:
getIndex in interface CharacterIterator
Returns:
the current index.
See Also:
CharacterIterator.getIndex()

equals

public boolean equals(Object obj)
Compares the equality of two StringCharacterIterator objects.

Overrides:
equals in class Object
Parameters:
obj - the StringCharacterIterator object to be compared with.
Returns:
true if the given obj is the same as this StringCharacterIterator object; false otherwise.
See Also:
Object.hashCode(), Hashtable

hashCode

public int hashCode()
Computes a hashcode for this iterator.

Overrides:
hashCode in class Object
Returns:
A hash code
See Also:
Object.equals(java.lang.Object), Hashtable

clone

public Object clone()
Creates a copy of this iterator.

Specified by:
clone in interface CharacterIterator
Overrides:
clone in class Object
Returns:
A copy of this
See Also:
Cloneable

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

5 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-2220
Document créé le 31/08/06 00:49, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-java/text/StringCharacterIterator.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,39 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Si l'herbe est plus verte dans le jardin de ton voisin, laisse-le s'emmerder à la tondre.

Fred Allen
 
l'infobrol
Nous sommes le Vendredi 01 Juin 2012, 19:48, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)