How do you removing special characters from a string

hi,
i'm a novice to java, if you couldn't tell. i need to write a program to recognise palindromes (eg. madam etc.) but i can't work out how to strip or clean the input string of white space or punctuation. any help appreciated. by the way, any other ideas on how to go about it?? (i don't expect it to be done, just after guidance)
my thanks in advance

OK Here you are:
protected static String removeJunk(String string)
          int i, len = string.length();
          StringBuffer dest = new StringBuffer(len);
          char c;
          for (i = (len - 1); i >= 0; i--)
               c = string.charAt(i);
               if (Character.isLetterOrDigit(c))
                    dest.append(c);
          return dest.toString();
Klint

Similar Messages

  • How can I remove special characters from spreadsheet filename?

    Hi
    Having a spreadsheet filename coded (on the Report Attributes page) as &VARIABLE..csv works fine unless the VARIABLE contains special characters such as space, lt, gt and so on.
    In the case of space, it is replaced by %20 in the generated filename. Is it possible convert the %20s to underscores (or remove them)?
    thanks
    Trevor

    Trevor,
    I would use a computation on that page to alter the value of variable, perhaps a SQL Expression such as:
      replace (:VARIABLE, ' ', '_')Alternatively, look at the process that puts the value into VARIABLE in the first place and ensure no spaces >, etc are assigned.
    Sergio

  • Removing special characters from a string

    Hi All,
    I have this in one my column in my table
    ABC-DEF
    ABC/DEF
    ABC,DEF
    ABC DEF
    I want to remove -, /, comma and space so i want the result like this
    ABCDEF
    ABCDEF
    ABCDEF
    ABCDEF
    How can I do this in PL/sql.
    Thanks.

    Use REGEXP_REPLACE:
    with sample_table as (
                          select 'ABC-DEF' str from dual union all
                          select 'ABC/DEF' from dual union all
                          select 'ABC,DEF' from dual union all
                          select 'ABC DEF' from dual
    -- end of on-the-fly sample table
    select  str,
            regexp_replace(str,'[-/, ]') new_str
      from  sample_table
    STR     NEW_STR
    ABC-DEF ABCDEF
    ABC/DEF ABCDEF
    ABC,DEF ABCDEF
    ABC DEF ABCDEF
    SQL> SY.

  • How do you insert special characters with imovie 08?

    How do you insert special characters into a project
    with imovie 08?

    Don't think that would work. Since my "system date" is already set at 2007. I have 2 imports, one has the year as 2048, and the other at 2016!! I don't know where they are getting these dates from, but they are not the system date.
    Were the files imported directly from a camcorder or from files already on your hard drive? In the first case the year may have been taken from the time "stamp" recorded when the footage was shot (which may or may not have been correctly set by the user). On the other hand, files imported from the hard drive seem to be keyed to the date the imported file is written to the "Events" folder which, of course, reflects the current system time/date setting. That's why I said you had to then import (re-import) the files from a hard drive source -- i.e., to ensure the DTG would be re-written.

  • How do you remove a playlist from the iPod but not the library

    How do you remove a playlist from the IPod but not the library?

    If it was originally on the camera roll try this: take another unimportant photo for test purposes, copy it to any special folder you have created within Photos, connect your iPad to your computer, locate it as any other external device, and most likely that Photos folder will be the only thing that will show up, locate the photo, delete it and then sync your iPad.
    If the test photo is gone from the camera roll but still in another folder within the app then you know that the system works so go ahead with the process. I understand that there are other photo apps which might let you achieve your goal much quicker.
    Hope thi helps.

  • How do you Remove a photo from the camera roll album without deleting from other albums

    How do you Remove a photo from the camera roll album without deleting from other albums

    If it was originally on the camera roll try this: take another unimportant photo for test purposes, copy it to any special folder you have created within Photos, connect your iPad to your computer, locate it as any other external device, and most likely that Photos folder will be the only thing that will show up, locate the photo, delete it and then sync your iPad.
    If the test photo is gone from the camera roll but still in another folder within the app then you know that the system works so go ahead with the process. I understand that there are other photo apps which might let you achieve your goal much quicker.
    Hope thi helps.

  • How do you remove credit card from apple store ios7

    How Do You Remove Credit Card From Apple Store With IOS7

    After establishing the Credit Card account (i.e. after you have made purchases), you can remove the credit card information by editing your payment info, choosing "None".
    Settings>iTunes and App Stores>Apple ID>View Apple ID>Sign-in>Payment Information

  • How do you remove credit card # from iTunes account

    How do you remove credit card # from iTunes account without entering a new one because added money to account from gift card?

    On your computer's iTunes you should be able to edit your payment info by going into the Store > View Account menu option and logging into your account, and on your account's details page there should be a payment link.  If you are doing it on your iPhone then try tapping on your id in Settings > iTunes & App Store and select 'View Apple ID' on the popup - that should also give you a payments link on your account's page.
    Changing payment info : http://support.apple.com/kb/HT1918

  • How do you remove a picture from a theme?

    Hi all gurus.
    This must be the most silly question so far in the forum but I have to ask again: How do you remove a picture from a theme?
    I uploaded a background picture for the Masthead Function Area but now I want to remove it. Since the correspodning field is blank when you go into the editor you can't erase the picture's URL
    What you can do is to browse to, and choose, a new picture and then erase the URL in the field. The mentioned area is then actually emptied and the color set in the field "Background Color of Masthead Function" is shown.
    But, and here is the problem, when you save the theme the picture is back again! Isn't there the possibility to show the background color, for which there is a field, instead of a picture? Do I really have to upload a picture just containing the color I want to have??? If so, that must be one of the most stupid functionaliteis I have seen in the portal so far, indeed...
    I'm most grateful for every suggestion of how to solve this in a decent way and not the idiotic "replace picture with another picture" way.
    Best regards
    Benny

    Hi Raghu.
    Unfortunately it didn't help. Their solution with writing "none" in the field is only applicable for those objects where you have a field determening ways of showing the object. There you have the different behaviours like "repeat", "non-repeat" and "none" and there you can write it directly in the field.
    The field of which I am talking doesn't have these options and hence not "none". I still tried it though but it didn't work, the picture was back after saving the theme.
    Best regards
    Benny

  • How do you remove a folder from an itunes library once it's been added?

    How do you remove a folder from an itunes library once it's been added?

    When you delete the song, a menu will come up and ask you if you want to trash or keep the file. Select "keep file."   It will no longer be in your song list but it will remain on your harddrive. To add it back in use the --"add to library"--  command in the  drop down "File" Menu (you have to navigagte to where the song is stored on your hard drive and select it-- to add it back in.
    Re: it ended up in the wrong album
    If your songs are going in the wrong place go to the "Get Info" command and check the information under all the tabs (look at a song that's in the right album to see how it's listed) -- one or more of the boxes is incorrect or empty.  Just put  in the right information and close the info window. That should put it back in the right spot for you.

  • How do you remove your iPad from account

    How do you remove a iPad from you iCloud account after you sold it

    Full checklist here...
    What to do before selling or giving away your iPhone, iPad, or iPod touch
    Bigwill123 wrote:
    How do you remove a iPad from you iCloud account after you sold it
    Access iCloud.com on a computer... http://support.apple.com/kb/PH2702

  • How do you remove duplicate images from your all images file on your mac desktop

    How do you remove duplicate images from your all images file on your mac desktop?

    Don't under any circumstances.
    All images is not a file. It's not a place. It's a list. Specifically, it's the result of an instruction: List all the images on my machine.
    When you delete something from All Images, then you have no idea what you're removing from where - files that are part of word processing docs, interface elements, corrupting your iPhoto Library. There are many perfectly legitimate reasons why you might have what appears to be duplicates but are not.
    Rule number One: Never delete anything on your machine whose job you don't understand.

  • How do you remove an object from a picture.  Newbie to program CS6

    how do you remove an object from a picture.  Newbie to program CS6

    Well, generally you can use the clone-stamp tool for one, shortcut is S. It basically allows you to take data from any part of the image and copy that over. What I do is draw on a new layer above the one to modify- make sure you select Sample:"This layer and below" in the top toolbar when doing so. Other ways include blending something on top of the object too, using different blending modes. Painting over it works too at times (rarely). It'd be easier if we knew a specific case though...

  • How do you remove unified contacts from iphone4s

    how can you remove unified contacts from iphone4s

    Reading and researching for 6 days.  Apple keeps calling back again and again.  I admire their punctuality but they keep rushing me through the same solutions over and over again.  I am really disappointed that they have an instruction manual they do not diverge fron.  Today was the 4th day they called.  I had deleted my phone twice following their suggestion and reset all settings which brought my iphone back to an awkward, unfamiliar state.  Nothing worked.
    I used all apps that have been suggested here ('Spring Clean' and 'Cleanup').  Did not work. They kept returning a message that said I have NO contacts on my phone.  My correct set of contacts contains 499 backed up on iCloud and of those 388 unfortunately duplicate against themselves thus creating a set of 'Unified accounts'.
    After all this research, inablity to manually delete one by one, back up from itunes during sync, deleting and restoring phone, the app that worked for me is called 'MultiDelete'.  I found all the apps, did a test drive on a couple and worked.  Applied to all.  All contacts were erased.  Turned iCloud contacts back on... I still am in awe. Very please and surprised that a problem I have had for more than a year is resolved!
    No more duplicate contacts when calling from Viber, Skype and any other contact-related app! Yes!

  • How do you remove downloaded iBooks from your purchase collection on iPad Air?

    How do you remove downloaded iBooks from your purchase collection on iPad Air? They won't go away and it's really annoying!

    Thanks to all who answered and are trying to help me.
    Here are some screen shots of what I'm talking about. I cleared out the cookies from Firefox, but do not know how to clear out the CACHE. As you can see its happening in all the webpages I open.

Maybe you are looking for

  • Yoga 2 Pro: downgrade to windows 7 ultimate

    Hi there, I recently purchased a Lenovo Yoga 2 pro laptop. (http://www.elgiganten.dk/product/pc-tablets/barbar-computer/LE59386592/lenovo-yoga-2-pro-13-3-multim... Since I'm not that excited for Windows 8, I decided to install Windows 7 ultimate. I f

  • Run away log problem...

    My hard drive space keeps getting eaten up by something. I've copied something that keeps repeating in the console log. Can anyone tell me how to fix this problem based on what the console log says? 2009-10-17 18:21:58 ERROR Uncaught Exception: at no

  • BAPI for inserting a schedule line

    I am needing to simulate a user going in the item availability screen in a sales order and creating multiple delivery dates.  Is there a way to do this though the sales order change BAPIs?  Any info would be appreciated.

  • Iphoto 11 export

    Iphoto 11 export function doesn't work.  Previously we had Kodak Gallery plugins and the forums adviced to remove these.  After some trouble (I'm a novice!!!) I found how to delete all the Iphoto plugins.  Now the export function still doen't work bu

  • INSTALLING FLASH PLAYER ON WINDOWS 7 ULTIMATE

    I WENT TO SITES THAT TELL ME TO INSTALL FALSHPLAYER WHEN I HAVE IT INSTALLED ALREADY I THINK,I GO TO INSTALL IT AGAIN AND IT DOES,USUALLY IT WILL SAY ALREADY INSTALLED BUT IT DOES'NT IT JUST INSTALLS OVER AND OVER IF I TRY.