Solved

How to use capital and small letter ?

Posted on 2010-09-03
6
222 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 51
by zero exception 10 52
Convert from a json string array to a Java object 3 51
Bot application - advice 3 37
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

809 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