viernes, 6 de diciembre de 2013

Metodos de la clase String en java – Curso – Texas

Mencionemos algunos métodos de la clase String y su funcionamiento.

El siguiente cuadro fue extraído de la documentación de java en el sitio web oracle.com.

Versión Ingles:

Method Summary
charcharAt(intindex)
Returns the character at the specified index.
intcompareTo(Objecto)
Compares this String to another Object.
intcompareTo(StringanotherString)
Compares two strings lexicographically.
intcompareToIgnoreCase(Stringstr)
Compares two strings lexicographically, ignoring case differences.
Stringconcat(Stringstr)
Concatenates the specified string to the end of this string.
booleancontentEquals(StringBuffersb)
Returnstrueif and only if thisStringrepresents the same sequence of characters as the specifiedStringBuffer.
staticStringcopyValueOf(char[]data)
Returns a String that represents the character sequence in the array specified.
staticStringcopyValueOf(char[]data, intoffset, intcount)
Returns a String that represents the character sequence in the array specified.
booleanendsWith(Stringsuffix)
Tests if this string ends with the specified suffix.
booleanequals(ObjectanObject)
Compares this string to the specified object.
booleanequalsIgnoreCase(StringanotherString)
Compares thisStringto anotherString, ignoring case considerations.
byte[]getBytes()
Encodes thisStringinto a sequence of bytes using the platform's default charset, storing the result into a new byte array.
byte[]getBytes(StringcharsetName)
Encodes thisStringinto a sequence of bytes using the named charset, storing the result into a new byte array.
voidgetChars(intsrcBegin, intsrcEnd, char[]dst, intdstBegin)
Copies characters from this string into the destination character array.
inthashCode()
Returns a hash code for this string.
intindexOf(intch)
Returns the index within this string of the first occurrence of the specified character.
intindexOf(intch, intfromIndex)
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
intindexOf(Stringstr)
Returns the index within this string of the first occurrence of the specified substring.
intindexOf(Stringstr, intfromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Stringintern()
Returns a canonical representation for the string object.
intlastIndexOf(intch)
Returns the index within this string of the last occurrence of the specified character.
intlastIndexOf(intch, intfromIndex)
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.
intlastIndexOf(Stringstr)
Returns the index within this string of the rightmost occurrence of the specified substring.
intlastIndexOf(Stringstr, intfromIndex)
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index.
intlength()
Returns the length of this string.
booleanregionMatches(booleanignoreCase, inttoffset,Stringother, intooffset, intlen)
Tests if two string regions are equal.
booleanregionMatches(inttoffset,Stringother, intooffset, intlen)
Tests if two string regions are equal.
Stringreplace(charoldChar, charnewChar)
Returns a new string resulting from replacing all occurrences ofoldCharin this string withnewChar.
booleanstartsWith(Stringprefix)
Tests if this string starts with the specified prefix.
booleanstartsWith(Stringprefix, inttoffset)
Tests if this string starts with the specified prefix beginning a specified index.
CharSequencesubSequence(intbeginIndex, intendIndex)
Returns a new character sequence that is a subsequence of this sequence.
Stringsubstring(intbeginIndex)
Returns a new string that is a substring of this string.
Stringsubstring(intbeginIndex, intendIndex)
Returns a new string that is a substring of this string.
char[]toCharArray()
Converts this string to a new character array.
StringtoLowerCase()
Converts all of the characters in thisStringto lower case using the rules of the default locale.
StringtoLowerCase(Localelocale)
Converts all of the characters in thisStringto lower case using the rules of the givenLocale.
StringtoString()
This object (which is already a string!) is itself returned.
StringtoUpperCase()
Converts all of the characters in thisStringto upper case using the rules of the default locale.
StringtoUpperCase(Localelocale)
Converts all of the characters in thisStringto upper case using the rules of the givenLocale.
Stringtrim()
Returns a copy of the string, with leading and trailing whitespace omitted.
staticStringvalueOf(booleanb)
Returns the string representation of thebooleanargument.
staticStringvalueOf(charc)
Returns the string representation of thecharargument.
staticStringvalueOf(char[]data)
Returns the string representation of thechararray argument.
staticStringvalueOf(char[]data, intoffset, intcount)
Returns the string representation of a specific subarray of thechararray argument.
staticStringvalueOf(doubled)
Returns the string representation of thedoubleargument.
staticStringvalueOf(floatf)
Returns the string representation of thefloatargument.
staticStringvalueOf(inti)
Returns the string representation of theintargument.
staticStringvalueOf(longl)
Returns the string representation of thelongargument.
staticStringvalueOf(Objectobj)
Returns the string representation of theObjectargument.

Versión Español:

Resumen Método
charcharAt(int index)
Devuelve el carácter en el índice especificado.
intcompareTo(Objecto)
Compara esta string a otro objeto.
intcompareTo(CadenaanotherString)
Compara dos cadenas lexicográfica.
intcompareToIgnoreCase(Cadenastr)
Compara dos cadenas lexicográfica, haciendo caso omiso de las diferencias de caso.
Stringconcat(Cadenastr)
Concatena la cadena especificada al final de esta cadena.
booleancontentEquals(StringBuffersb)
Devuelveverdaderosi y sólo si estastringrepresenta la misma secuencia de caracteres como la especificadaStringBuffer.
static StringcopyValueOf(char [] data)
Devuelve una cadena que representa la secuencia de caracteres en la matriz especificada.
static StringcopyValueOf(char [] datos, int desplazamiento, int count)
Devuelve una cadena que representa la secuencia de caracteres en la matriz especificada.
booleanendsWith(Cadenasufijo)
Comprueba si la cadena termina con el sufijo especificado.
booleanequals(ObjectunObjeto)
Compara esta cadena para el objeto especificado.
booleanequalsIgnoreCase(CadenaanotherString)
Compara esta stringa otrastring, haciendo caso omiso de las consideraciones del caso.
byte []getBytes()
Codifica lastringen una secuencia de bytes utilizando charset por defecto de la plataforma, almacenando el resultado en una nueva matriz de bytes.
byte []getBytes(CadenacharsetName)
Codifica lastringen una secuencia de bytes mediante el juego de caracteres con nombre, almacenando el resultado en una nueva matriz de bytes.
vacíogetChars(int srcBegin, int srcEnd, char [] dst, int dstBegin)
Copias caracteres de esta cadena en la matriz de caracteres de destino.
inthashCode()
Devuelve un código hash para esta cadena.
intindexOf(int ch)
Devuelve el índice dentro de esta cadena de la primera aparición del carácter especificado.
intindexOf(int ch, int fromIndex)
Devuelve el índice dentro de esta cadena de la primera aparición del carácter especificado, comenzando la búsqueda en el índice especificado.
intindexOf(Cadenastr)
Devuelve el índice dentro de esta serie de la primera ocurrencia de la subcadena especificada.
intindexOf(Cadenastr, int fromIndex)
Devuelve el índice dentro de esta serie de la primera ocurrencia de la subcadena especificada, comenzando en el índice especificado.
Stringintern()
Devuelve una representación canónica para el objeto de cadena.
intlastIndexOf(int ch)
Devuelve el índice dentro de esta cadena de la última aparición del carácter especificado.
intlastIndexOf(int ch, int fromIndex)
Devuelve el índice dentro de esta cadena de la última aparición del carácter especificado, buscando hacia atrás, empezando por el índice especificado.
intlastIndexOf(Cadenastr)
Devuelve el índice dentro de esta cadena de la ocurrencia más a la derecha de la subcadena especificada.
intlastIndexOf(Cadenastr, int fromIndex)
Devuelve el índice dentro de esta cadena de la última aparición de la subcadena especificada, buscando hacia atrás, empezando por el índice especificado.
intlength()
Devuelve la longitud de esta cadena.
booleanregionMatches(ignoreCase boolean, int Tdesplazamiento,string otra, int ooffset, int len)
Comprueba si dos regiones de cadenas son iguales.
booleanregionMatches(int Tdesplazamiento,Cadenaotra, int ooffset, int len)
Comprueba si dos regiones de cadenas son iguales.
Stringreplace(char oldChar, char newChar)
Devuelve una nueva cadena resultante de reemplazar todas las apariciones deoldCharen esta cadena connewChar.
booleanstartsWith(Cadenaprefijo)
Comprueba si la cadena comienza con el prefijo especificado.
booleanstartsWith(Cadenaprefijo, int Tdesplazamiento)
Comprueba si la cadena comienza con el prefijo especificado a partir de un índice determinado.
CharSequencesubsecuencia(int beginIndex, int endIndex)
Devuelve una nueva secuencia de caracteres que es una subsecuencia de esta secuencia.
Stringsubstring(int beginIndex)
Devuelve una nueva cadena que es una subcadena de esta cadena.
Stringsubstring(int beginIndex, int endIndex)
Devuelve una nueva cadena que es una subcadena de esta cadena.
char []ToCharArray()
convierte esta cadena a una nueva matriz de caracteres.
StringtoLowerCase()
Convierte todos los personajes de estastringa minúsculas utilizando las reglas de la configuración regional predeterminada.
StringtoLowerCase(Localelocale)
Convierte todos los personajes de estastringa minúsculas utilizando las reglas de lo dadoLocale.
StringtoString()
Este objeto (que ya es una cadena!) es en sí regresaron.
StringtoUpperCase()
Convierte todos los personajes de estastringa mayúsculas utilizando las reglas de la configuración regional predeterminada.
StringtoUpperCase(Localelocale)
Convierte todos los personajes de estastringa mayúsculas utilizando las normas de la dadaLocale.
Stringtrim()
Devuelve una copia de la cadena, con el espacio inicial y final se omite.
static StringvalueOf(boolean b)
Devuelve la representación de cadena delbooleanargumento.
static StringvalueOf(char c)
Devuelve la representación de cadena delcharargumento.
static StringvalueOf(char [] data)
Devuelve la representación de cadena delcharargumento de matriz.
static StringvalueOf(char [] datos, int desplazamiento, int count)
Devuelve la representación de cadena de una submatriz específica delcharargumento de matriz.
static StringvalueOf(double d)
Devuelve la representación de cadena deldobleargumento.
static StringvalueOf(float f)
Devuelve la representación de cadena delflotadorargumento.
static StringvalueOf(int i)
Devuelve la representación de cadena delintargumento.
static StringvalueOf(long l)
Devuelve la representación de cadena de lalargadiscusión.
static StringvalueOf(Objectobj)
Devuelve la representación de cadena delobjetoargumento.

fuente:oracle.com

No hay comentarios:

Publicar un comentario