hello can you help me please what is the string method to be use when searching a keyword

that can be found in first, middle, end of the word...

example "CH"

this will search all names having this "CH"...can you help me what is the string method to use this...hoping for your positive responds...

Have a look at the contains(...) method in the String class (ps: in case you are worried, CharSequence is just an Interface implemented by all Strings)

To check whether a string starts or end with a particular pattern of strings u can use

startsWith(String prefix)
Tests if this string starts with the specified prefix.
boolean startsWith(String prefix, int toffset)
Tests if this string starts with the specified prefix beginning a specified index.

to check for string ending with a particular pattern

boolean endsWith(String suffix)
Tests if this string ends with the specified suffix.


To check in middle you have to use a substring function to extract the particular pattern and then compare it....

Hope it might help u a lil bit....

To check in middle you have to use a substring function to extract the particular pattern and then compare it....

Not true. Use contains(...)

Not true. Use contains(...)

hello thank you for the reply...okay i will try this method contains...thank you for helping me i will write again if i have doubt on this...more power to you...thank you again...

To check whether a string starts or end with a particular pattern of strings u can use

startsWith(String prefix)
Tests if this string starts with the specified prefix.
boolean startsWith(String prefix, int toffset)
Tests if this string starts with the specified prefix beginning a specified index.

to check for string ending with a particular pattern

boolean endsWith(String suffix)
Tests if this string ends with the specified suffix.


To check in middle you have to use a substring function to extract the particular pattern and then compare it....

Hope it might help u a lil bit....

hello sir thank you for the reply and for helping me...i will write again if i have doubt...more power to you sir...

Have a look at the contains(...) method in the String class (ps: in case you are worried, CharSequence is just an Interface implemented by all Strings)

Hello i tried the contains() and it works thank you for helping me...

This question has already been answered. Start a new discussion instead.