VB icon

String Handling

Email
Submitted on: 10/8/2019 6:50:36 AM
By: hari 
Level: Intermediate
User Rating: Unrated
Compatibility: Java (JDK 1.5)
Views: 216
 
     Code for Beginners in Java

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: String Handling
// Description:Code for Beginners in Java
// By: hari
//**************************************

import java.util.Scanner; 
class StrB
{
 public static void main(String args[])
{
int i, j=0,found=0,len=0;
Scanner sc = new Scanner(System.in);
System.out.print("Enter your name: ");
String string = sc.nextLine();
 StringBuilder S=new StringBuilder(string);
 StringBuilder rev=new StringBuilder("");
 int l=S.length();
 System.out.println("Program For Implementing String Builder");
 System.out.println("***************************************");
 System.out.println("The length Of the String =" +l);
 System.out.println("***************************************");
 System.out.println("The Orginal String is =" +S);
 System.out.println("***************************************");
Scanner sc1 = new Scanner(System.in);
System.out.print("Enter The string to concat: ");
String string_concat = sc1.nextLine();
StringBuilder S1=new StringBuilder(string_concat);
StringBuilder concated=new StringBuilder("");
concated.append(S).append(" ").append(S1);
System.out.println("The Concated String is =" +concated);
System.out.println("***************************************");
Scanner sc2 = new Scanner(System.in);
System.out.print("Enter The string to search: ");
String c_srch = sc.nextLine();
StringBuilder S3=new StringBuilder(c_srch );
if(concated.toString().contains(S3.toString())) { 
System.out.println("This string contains the character:" +S3); 
System.out.println("***************************************"); 
 }
else 
{ 
 System.out.println("This string Doesn't contains the character" +S3); 
 System.out.println("***************************************"); 
} 
 int l1=concated.length(); 
 for( i=l1-1;i>=0;i--)
{
 rev=rev.append(concated.charAt(i));
}
System.out.println("The reversed String is :" +rev);
 System.out.println("***************************************");
}
}


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.