The Artima Developer Community
Sponsored Link

Java Buzz Forum
Remove Character from string in java

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
instanceof java

Posts: 576
Nickname: instanceof
Registered: Jan, 2015

instanceof java is a java related one.
Remove Character from string in java Posted: Sep 18, 2015 12:30 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by instanceof java.
Original Post: Remove Character from string in java
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java

Advertisement

#1: Java Program to Remove all occurrences of a string 

  1. package com.instanceofjava;
  2.  
  3. class RemoveCharString{
  4.  
  5. public static void main(String [] args){ 

  6.   String str = "Java";
  7.     str = str.replace("a", "");
  8.     System.out.println(str);
  9. }
  10. }
Output:
  1. Jv

#2: Java Program to Replace First occurance of Specific index char in a String

  1. package com.instanceofjava;
  2.  
  3. class RemoveCharString{
  4.  
  5. public static void main(String [] args){ 

  6.   String str = "Java";
  7.  
  8. //String result = str.substring(0, index) + str.substring(index+1);
  9.  
  10.   String result = str.substring(0, 1) + str.substring(1+1);
  11.   System.out.println(result);
  12.  
  13. }
  14. }
Output:
  1. Jva


#3: Java Program to Remove all Numbers from a string.

  1. package com.instanceofjava;
  2.  
  3. class RemoveNumberString{
  4.  
  5. public static void main(String [] args){ 

  6.   String str = "Instance12ofjava143";
  7.   str = str.replaceAll("[0-9]","")
  8.   System.out.println(str);
  9.  
  10. }
  11. }
Output:
  1. Instanceofjava

Read: Remove Character from string in java

Topic: IntelliJ IDEA 15 EAP 142.4859 is Out! Previous Topic   Next Topic Topic: Real-time Applications with AngularJS and Java – Part 1

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use