Results 1 to 2 of 2

Thread: Blank space

  1. #1
    sandy1028 is offline Member
    Join Date
    Apr 2009
    Rep Power

    Default Blank space


    How to convert character to one blank space using regular expression

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    New Zealand
    Rep Power


    Perhaps you could be more specific?

    If you want to convert every character to a blank space, use the String method length() to determine how many characters there are then make a new String with that many spaces.

    If there are certain restrictions on the character you could use a regular expression:

    Java Code:
    String data = ...
    String regex = /*whatever*/
    data = data.replaceAll(regex, " ");
    If it's a particular character:

    Java Code:
    String data = ...
    char chToBeReplaced = /*whatever*/
    data = data.replace(String.valueOf(chToBeReplaced), " ");

Similar Threads

  1. how can we remove blank lines from a .txt
    By Camden in forum New To Java
    Replies: 12
    Last Post: 07-29-2011, 01:38 PM
  2. Tiff Split when it found blank pages
    By jazz2k8 in forum Advanced Java
    Replies: 2
    Last Post: 08-25-2008, 12:04 PM
  3. netbeans 6.0 not show commpunent or show blank page
    By fahimaamir in forum NetBeans
    Replies: 1
    Last Post: 01-26-2008, 07:20 AM
  4. Print a blank space
    By susan in forum New To Java
    Replies: 2
    Last Post: 07-30-2007, 01:58 PM
  5. Blank result for jsp_servlet in Eclipse
    By Unni in forum Eclipse
    Replies: 2
    Last Post: 07-12-2007, 04:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts