Solved

How to use capital and small letter ?

Posted on 2010-09-03
6
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jsp login check 12 67
Html split(text) 2 49
Strange router problem - can't access hotmail.com 14 108
listing all the respondents to a twitter feed - Java 5 48
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

738 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