Results 1 to 9 of 9
  1. #1
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default how to remove characters

    what am i doing wrong, with removing these characters?

    for(int i = 0; i<task.length(); i++) {
    if(task.charAt(i) != 'Ø' && task.charAt(i) != '§') {
    taskLine = task + task.charAt(i);
    } else {
    System.out.println();
    }
    }

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: how to remove characters

    taskLine = task + task.charAt(i);
    Are you sure you want to concatenate the character to task and assign the result to taskLine?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: how to remove characters

    Quote Originally Posted by Eranga View Post
    What happen when you run this code segment, error?
    it doesn't remove those special characters.

  5. #5
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: how to remove characters

    Quote Originally Posted by DarrylBurke View Post
    Are you sure you want to concatenate the character to task and assign the result to taskLine?

    db
    not sure what you mean, but maybe should it be taskLine = taskLine + task.charAt(i); ?

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default Re: how to remove characters

    Yes, but what does it do?
    Shows us an input and an output from the code...and possibly answer Darryl's question as well.

  7. #7
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: how to remove characters

    input: Task1Ødo this!Ø1§ (from a txt file) output: Task1Ødo this!Ø1§

    and i think i answered it, didn't i? i am just putting the current phrase together, with the new character. that is all that that should be really doing.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default Re: how to remove characters

    Sorry, we'd cross-posted.
    I must have had the window open for a couple of minutes.
    But I suspect that was what Darryl was suggesting...except your last character is not being double up, which is what I would expect.

  9. #9
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: how to remove characters

    here is what i would like to do, ultimately:

    read this text file:
    Task1Ødo this!Ø1§

    where Ø shows up, enter the following text on a new line. where § occurs, break out two new lines for the next task. also, let's say they want to edit task 5. what would be the best way to organize this file, and go directly to that line, and start reading it?

    i would really appreciate any coding help, because i keep on fumbling and i think i am making it harder than it really is :p
    Last edited by droidus; 01-18-2012 at 03:03 AM.

Similar Threads

  1. ArrayList and remove()
    By Pragz in forum New To Java
    Replies: 1
    Last Post: 04-21-2011, 01:42 AM
  2. Remove .0
    By maple_leafs182 in forum New To Java
    Replies: 4
    Last Post: 01-28-2011, 02:47 AM
  3. Remove control characters in txt file
    By trivektor in forum New To Java
    Replies: 7
    Last Post: 09-23-2008, 04:22 PM
  4. How to remove Control Characters from an input file?
    By renjan in forum Advanced Java
    Replies: 0
    Last Post: 08-01-2007, 03:33 PM

Posting Permissions

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