• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting rid of Carriage returns
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting rid of Carriage returns


  • Subject: Getting rid of Carriage returns
  • From: Calven Eggert <email@hidden>
  • Date: Thu, 23 Dec 2004 14:46:31 -0500

Title: Getting rid of Carriage returns
Hi All,

I have text I want to export to an Excel file.  The text for a field may have carriage returns in it so I need to remove them and replace them with spaces.  I’ve used StringTokenizer and then I used the Class String replace method and they both are not working for me.

Here is my little routine:

   
public String removeReturns(String beforeStr) {
        String tempStr = "";
        StringTokenizer textTokens = new StringTokenizer(beforeStr, "\n", false);
        while(textTokens.hasMoreTokens()) {
            String aToken = (String)textTokens.nextToken();
            tempStr += aToken;
        }
        return tempStr;
    }


It doesn’t work.  It still returns my string with the carriageretuns in it.

Can anyone help?

Calven
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Getting rid of Carriage returns
      • From: Kaj Hejer <email@hidden>
    • Re: Getting rid of Carriage returns
      • From: Francis Labrie <email@hidden>
  • Prev by Date: Re: Strange WebServerResources folder name issue inside .woa problem
  • Next by Date: Re: Getting rid of Carriage returns
  • Previous by thread: Re: Strange WebServerResources folder name issue inside .woa problem
  • Next by thread: Re: Getting rid of Carriage returns
  • Index(es):
    • Date
    • Thread