What's Here?
- Members: 118,876
- Replies: 435,632
- Topics: 67,345
- Snippets: 2,415
- Tutorials: 641
- Total Online: 1,873
- Members: 70
- Guests: 1,803
Who's Online?
|
Welcome to Dream.In.Code |
|
Getting Java Help is Easy!
Join 118,876 Java Programmers for FREE! Ask your question and get quick answers from experts. There are 1,873 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!
|
An example of some string manipulation techniques.
|
Submitted By: jayman9
|
|
Rating:
  
|
|
Views: 2,302 |
Language: Java
|
|
Last Modified: July 29, 2006 |
Snippet
import java.lang.String;
import javax.swing.JOptionPane;
public class StringExercise1
{
public static void main (String[] args )
{
textString = JOptionPane. showInputDialog("Enter a string:");
totalString(textString);
convLowerCase(textString);
replaceLetters(textString);
convUpperCase(textString);
}
public static void totalString (String text )
{
System. out. println("The length of the string " + text + " is "
+ text.length());
}
public static void convLowerCase (String text )
{
System. out. println("Here it is in lower case "
+ text.toLowerCase());
}
public static void replaceLetters (String text )
{
System. out. println("Here it is with the a and z swapped "
+ text.replace('a','z'));
}
public static void convUpperCase (String text )
{
System. out. println("Here it is in upper case "
+ text.toUpperCase());
}
}
Copy & Paste
|
|
|
Reference Sheets
Bye Bye Ads
Free DIC T-Shirt
Related Sites
Monthly Drawing
Partners
Top Contributors
Top 10 Kudos This Month
|