Hi there!

Need help wid this.
i need to change all the uppercase characters to lowecase and vice versa.
when i compile it shows cannot find symbol on line 13 and 18.
Kindly help.
Also tell me how to make the first letter of each word in uppercase.

thnx in advance..

import java.io.*;
public class string_manupulation {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		System.out.println("You Entered: "+s);
		char c;int i;
		String y;
		for(i=1;i<s.length();i++)
		{
			if((s.charAt(i)>'A')&&(s.charAt(i)<'Z'))
			{
				s=s.toLowerCase(s.charAt(0));
				break;
			}
			else if((s.charAt(i)>'a')&&(s.charAt(i)<'z'))
			{
				s=s.toUpperCase(s.charAt(0));
				break;
			}
			else
			{
				System.out.println("No changes made.");
				break;
			}
		}
		System.out.println("Manipulated String: "+s);
	}
}

Recommended Answers

All 3 Replies

it shows the functions
tried it all not working can u tell d logic?

I think it can work if all the characters at starting and after spaces are capitalized...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.