Solved

How to use capital and small letter ?

Posted on 2010-09-03
6
220 Views
Last Modified: 2012-06-27

Hi ,
I have some  search condition a,e,i,o,u

iN search screen user enter sathish as search word means  , I check with search condition if any letter which is enter by user is equal means then  

the i pass the search word as  sathish,sAthish this 2 words

if it not match means  pass same value sathish

I am try in hashMap but i cant get the correct solution can any one give an idea

how to achive this ??
0
Comment
  • 4
6 Comments
 
LVL 20

Author Comment

by:Sathish David Kumar N
ID: 33594304
if the user enter sathise means
 
passing parameter is sathishe,sAthishE
0
 
LVL 20

Author Comment

by:Sathish David Kumar N
ID: 33594323
sorry typo error h i wrongly enter
sathise ,sAthisE
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 33594619
Please rephrase the question a little bit in terms of, if user enters sathish, what should happen?

If you are looking for case-insensitive search, then by simply converting the query text and the text to be searched, you can get the desired results
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 20

Author Comment

by:Sathish David Kumar N
ID: 33595030
If you senter some value for search means then that word will goto  DB to search the word present or not .
They(user) have some search condition .
that condition is a,e,i,o,u this letter present in ur search word means  you have change that in to  Caps(that particular word only) and pass both words ,
if it not not match means send same word

if the user enter sathishe means
 
passing parameter is sathishe,sAthishE (here a,e is there in condition so covert to caps and we pass both)
 if the user enter nsk means
 
passing parameter is nsk
 
I think you understand my condition
 
0
 
LVL 4

Expert Comment

by:msk_apk
ID: 33595880
You can have the user to select their search is case sensitive or case insensitive. if its case sensitive, then its enough to maintain only one hashmap. user's input and your storage should follow the same syntax i.e no formatting is needed at all. Likewise you need to maintain case insensitive hashmap where store the keys with either lowercase or uppercase after formatting the raw input. Same transformation has to be made when the user is giving the input. i.e either it has to be changed to lowercase or uppercase.

0
 
LVL 20

Accepted Solution

by:
Sathish David  Kumar N earned 0 total points
ID: 33596424
some what like this code ....
HashMap specialChar= new HashMap();

		String s1="";

		String s2="";

		for(int i=0;i<s.length();i++)

		{

			

			

			boolean e=specialChar.containsKey( Character.toString(s.charAt(i)));

			

			if(e==true)

			{

				String g =(specialChar.get(Character.toString(s.charAt(i)))).toString();

				

				String[] sp=g.split(",");

				s1=s1+sp[0];

				s2=s2+sp[1];

			

			}

			if(e==false)

			{

				s1=s1+Character.toString(s.charAt(i));

				s2=s2+Character.toString(s.charAt(i));

			}

		

		}

		  System.out.println(s);

		  System.out.println(s1);

		  System.out.println(s2);

		  

		return s1+","+s2;

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Which is the latest version of Apache Tomcatl 3 49
for i loop in grovy 1 44
Core Java. What output will be and why ? 6 64
javap not working 8 35
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now