Substring

What is Substring?


1.

Java stuff. When you want to derivate a String from a String you already have, lets say you want to get "burger" out of "hamburger" you apply. stringName.substring(3), this is the same as having "burger" since it will take "hamburger" and from the position in 3 (programming uses 0 as the first position), it will display the rest of the String.

If you want from certain position to another, lets say "mistaken" and you just want "stake", you will need to apply: stringName.substring(2,6), this will give you "stake".

public int resultado(String buscado, String origen) {

int cont = 0;

int lng=buscado.length();

for(int i=0;i<=(origen.length()-lng);i++){

if ( buscado.equals (origen.substring(i,(i+lng) ) ) )

cont++;

}

/** AQUI DEBES DE CODIFICAR PARA CONTAR CUANTAS VECES BUSCADO ESTA EN ORIGEN */

return cont;

}

See java, string, g string, substring, programming


44

Random Words:

1. 1-A band 2-A T.V. group 3-A way of life That Zapetroid... See za, pe, tr, o, id..
1. Is the name given an alcoholic drink consisting of 4 parts vodka, 4 parts bourbon, 2 parts gin, 4 parts tequilla, 6 parts Hawaiian Punc..
1. One who cups nuts firmly in the palm of their hand. Used as an insult to either guy or girl. Mainly to refer to the whore-ishness of sai..