How can I remove all non alpha/space characters from a string

Subject changed by moderator.  Please use a meaningful subject in future.
Hi all,
Can anyone tell me.
how to get only alphabets & spaces from the string..
suppose..
raj*&{]afhajk ajkf_+#fkh jah jka7767jk hhha
I need only
rajafhajk ajkf fkh jah jkajk hhha
thanks..
Rajeev
Edited by: Matt on Feb 17, 2009 3:36 PM

This will work.
CONSTANTS:
  sm2big(52) VALUE
    'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'.
DATA:
  str_out(60),
  str_in(60) VALUE
  'raj*&{]afhajk ajkf_+^#^fkh jah jka7767jk hhha',
  my_len          TYPE i,
  pos1            TYPE i,
  pos2            TYPE i.
START-OF-SELECTION.
  COMPUTE my_len = strlen( str_in ).
  CLEAR pos1.
  CLEAR pos2.
  WHILE pos1 LT my_len.
    IF str_in+pos1(1) co sm2big
    OR str_in+pos1(1) EQ ' '.
      str_out+pos2(1) = str_in+pos1(1).
      pos2 = pos2 + 1.
    ENDIF.
    pos1 = pos1 + 1.
  ENDWHILE.
  WRITE:/ 'String In', str_in.
  WRITE:/ 'String Out', str_out.
and the output
String In      raj*&{]afhajk ajkf_+^#^fkh jah jka7767jk hhha
String Out   rajafhajk ajkffkh jah jkajk hhha            

Similar Messages

  • Removing non-alpha-numeric characters from a string

    How can I remove all non-alpha-numeric characters from a string? (i.e. only alpha-numerics should remain in the string).

    Or even without a loop ?
    Extract from the help for the Search and Replace String function :
    Right-click the Search and Replace String function and select Regular Expression from the shortcut menu to configure the function for advanced regular expression searches and partial match substitution in the replacement string.
    Extract from the for the advanced search options :
    [a-zA-Z0-9] matches any lowercase or uppercase letter or any digit. You also can use a character class to match any character not in a given set by adding a caret (^) to the beginning of the class. For example [^a-zA-Z0-9] matches any character that is not a lowercase or uppercase letter and also not a digit.
    Message Edité par JB le 05-06-2008 01:49 PM
    Attachments:
    Example_VI_BD4.png ‏2 KB

  • How can I remove all my preferences and settings from mail and do a clean install of mail app?

    How can I remove all my preferences and settings from mail and do a clean install of mail app?

    Open mail > Preferences > Accounts
    Select the account and click the minus button at the bottom of the column.
    Quit mail
    ~/Library/Preferences/com.apple.mail.plist move this file to the trash and empty it.
    ~/Library/Mail/ and move all of the items in that folder to the trash and then empty it.

  • How can i remove all of the purchased songs from my phone?

    I want to remove all of the purchased songs from my phone, but I'm not having any success.  I've transferred the purchases to iTunes, and turned off the cloud on my phone, but they are still there.  They will not let me delete them...

    Roy631 wrote:
    They go away until the next sync and then they return to the list.  They are shown in iTunes greyed out with a broken circle in the first column when manually viewing them.
    It's an iPhone 5S, I'm running the latest OS, 8.1.
    OK, maybe time to get extreme.  I've had similar experiences, sometimes occurring after making direct-to-device purchases and sometimes after doing an iOS update.  In the two times I've experienced what you've seen I've fixed it by digging deeper, bear with me:
    If your iPhone is not set for manual management, do so. (i.e. select "Manually manage music and video")
    While connected to iTunes, navigate the contents of the iPhone.  Select all songs and delete them.  Ignore the gray ones if still present.
    Eject the iPhone and go to Settings/ General/ Usage/ Manage Storage.  Let the list populate then select the Music category.  In the next screen, swipe across "All Songs" from right to left and tap Delete.
    Connect back to iTunes, perform a backup, then restore the iPhone and reload the backup.
    Your iPhone should now have its settings, accounts, and apps back, but no music -- not even the "ghost" entries.  Add the music back that you want, either via manually dragging and dropping from iTunes, or auto-syncing all or a portion of your library.
    Some people reported luck with just step #3.  The problem I've had with that, is any music that I want remaining on the iPhone gets corrupted, such that playback will skip and/or show the wrong artwork.  By deleting all music first, then following up with a restore, that seems to clear the problem.  Personally I avoid direct-to-device purchases since I've had spooky occurrences almost every time where the purchases are very difficult to remove.

  • How can I remove a non=working windows partition from my mac?

    Alright so when I got my computer around 3 years ago my mom installed Windows on it. Sadly it didn't work and there was an uninstall so it uninstalled it, but now I have this 10 GB windows partition that's still there but I can't boot up on it and it's wasting 10 GB of my space. HOw can I get rid of it without risking of personal data (on my mac partition)

    Hi Midnight Pharaoh;
    Seeing as how I don't allow anything from Microsloth into my house I am not able to answer your question from personal experience but I believe that Boot Camp can in addition to creating a partition for Winders also delete said partition. If you need more details you might try reposting in the Boot Camp forum instead of the Snow Leopard forum.
    Allan

  • I dont know if this will be in the right forum, if its not feel free to move it, but i was only wondering how can i remove all my credit card info from my apple id account but still keep the account?

    basically what title says ^^^^ it on a iphone 4s

    Go to the store in iTunes and in the top right click on your account. You can add or remove payment info there.

  • How can I remove all returns within the text?

    I copied and pasted text onto pages from the internet, but the text does not go all the way to the end of the set margins that i have on Pages, instead it goes about halfway or so and begins on a new line. how can i remove all of the spaces between the words so that it runs the full length of the page.
    It blows my mind that i have to resort to seeking help on the apple forums for this problem, it seems like something so simple would be a standard feature when adjusting text on the page. The only thing that could frustrate me more is if it impossible to do on this software, or if it is simple to do and I was too stupid to figure it out. If it is impossible then I'm **** out of luck because the document is just to **** long to sit there for hours and manually delete every single last return.

    Not to preempt your fun of playing with AppleScript, but here's my take on it:
    tell application "Pages"
        tell document 1
            -- Make sure there's no selection
            select insertion point before character 1
            set cc to count characters of body text
            set returnOffsets to (character offset of every character where it is return)
            -- Reverse order, since deletion would alter all subsequent offsets
            repeat with n in reverse of returnOffsets
                if (n > 1) then
                    if n < cc and character (n + 1) is return then
                        -- Treat double returns as a true paragraph break.
                        -- Delete the extra.
                        delete character n
                    else if character (n - 1) ≠ return then
                        -- Change single returns into spaces.
                        set character n to " "
                    end if
                end if
            end repeat
        end tell
    end tell

  • When trying to download yosemite it sais that i do not have enough memory. when i look at my memory use it shows that 111.00gb of space is used by movies but when i go th the movie folder it is empty. how can i remove the non existant movies.

    when trying to download yosemite it sais that i do not have enough memory. when i look at my memory use it shows that 111.00gb of space is used by movies but when i go th the movie folder it is empty. how can i remove the non existant movies.

    Freeing Up Space on The Hard Drive
      1. See Lion/Mountain Lion/Mavericks' Storage Display.
      2. You can remove data from your Home folder except for the /Home/Library/ folder.
      3. Visit The XLab FAQs and read the FAQ on freeing up space on your hard drive.
      4. Also see Freeing space on your Mac OS X startup disk.
      5. See Where did my Disk Space go?.
      6. See The Storage Display.
    You must Empty the Trash in order to recover the space they occupied on the hard drive.
    You should consider replacing the drive with a larger one. Check out OWC for drives, tutorials, and toolkits.
    Try using OmniDiskSweeper 1.8 or GrandPerspective to search your drive for large files and where they are located.
    You will need a minimum of 10-12 GBs of free space to install Yosemite, however, that is a bare minimum and should be at least twice that amount.

  • How can i remove all PC authorizations from iTunes account?

    How can i remove all PC authorizations from iTunes account?

    Removing a credit card from an account - iTunes Store: Changing Account Information - http://support.apple.com/kb/HT1918 - More information at: https://discussions.apple.com/message/15891166

  • How can I remove all photos from my iphone?

    How can I remove all photos from my iphone?

    Hi pjdemeo,
    I understand you want to delete all of the photos from your iPhone.  As a precaution, I would suggest importing the photos and videos from your iPhone into your computer.  This will give you a backup for the images, and after import you will be asked if you want to delete the photos.
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support
    https://support.apple.com/en-us/HT201302
    The iPhone User Guide has instructions for deleting photos directly from the device:
    Organize photos and videos - iPhone
    http://help.apple.com/iphone/8/#/iphf14943e
    Delete a photo or video from Photos. Tap the Photos tab, tap the photo or video, tap , then tap Delete Photo or Delete Video. Deleted photos and videos are kept in the Recently Deleted album on iPhone, with a badge showing the remaining days until the item is permanently removed from iPhone. To delete the photo or video permanently before the days expire, tap the item, tap Delete, then tap Delete Photo or Delete Video. If you use iCloud Photo Library beta, deleted photos and videos are permanently removed from all iOS 8.1 devices that use iCloud Photo Library beta with the same Apple ID.
    Cheers,
    - Judy

  • How can I remove all photos and directories from iPhoto?

    How can I remove all photos and directories from iPhoto as if it was a brand new install?
    I am new to iPhoto and was unaware of how it works, honestly I still am a little confused as to when pics I am using 1/2 the time, some from iPhoto and some from MyPics.
    Anyhow, I am looking to remove all photos from iPhoto because during the migration of all my photos from PC to MAC, somehow my timeline became messed up and all my photos that have been logged my dates since 1998 are now all messed up.
    Although all my year folders are still in tact, IE 1998-2006, the subfolders and like pics are all intertwined somehow.
    And when I search iPhoto for a given year, photos from 2,4, 8 yrs back show up in 2006.
    Anyhow, I have selected and deleted all photos and folders within iPhoto, and then import the desired photos from MyPics, only to have the photos double up in the library. ( The old ones that should be deleted and the new imports)
    I simply don't get it, they fill the trash and disappear when it's emptied, then reappear when iPhoto re-opens!
    Can someone help????
    I have completely reworked all my photos so that they are all in the correct folders outside of iPhoto, and now I want to import those and only those pics with that file structure.
    IE Structure = YEAR > MONTH > DAY ( or if needed) > DAY/EVENT

    Do you want to remove the existing full sized image files also? If so then just drag the iPhoto Library folder from the Pictures folder to the Trash and empty it. But be warned you'll lose all of your image files.
    You are dragging the files to the iPhoto Trash bin and then using the iPhoto->Empty Trash menu, right?
    In copying your photos to myspace and then back the original capture date may not be retained and then either the created date or modified date will be used by iPhoto. If the files in the current library are the originals from your camera then those have the best chance of retaining the correct Captured Date. You can check that out by dragging the Originals folder from your iPhoto Library folder to the desktop and then trash what remains of the iPhoto Library folder. Then launch iPhoto and it will ask you to create an new library. Then import that Originals folder and it's subfolders by dragging it into iPhoto's open window. You'll keep the same rolls that was. The roll dates may change but you can check the captured date of the files by using the calendar in the Source pane.
    You won't be able to keep your folder structure within iPhoto. Each outside folder will result in a roll with the same title as the folder. You'll be able to create folders in the Source pane to put albums inside. You can create a smart album to include all photos in a certain date range, line one month.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    G5 Dual Core 2GHz, 2G RAM, 250G HD; G4 Dual 1Ghz, 1.5G RAM, 80G HD,   Mac OS X (10.4.7)   22 LCD Display, 200G & 160G FW HDs, Canon S400, i850 & LIDE 50, Epson R200

  • How can i remove all contact at once from ovi?

    after synchronise with ovi & my mobile how can i remove all contact from my ovi's contact.
    I can remove one by one but i want to remove all at once. how possible??
    Solved!
    Go to Solution.

    @tkwcare:
    Beware of that method. Restoring your contacts after sync'ing will restore the phone to a state with a timestamp prior to when the sync occurred. Sync'ing again will attempt to bring the phone up to date with the online resource and, in doing so, will delete all the contacts off the phone!
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • 5.0 and 6.0 became entngle, and neithr will start. How can I remove all traces of Firefox and do a "clean" reinstall? Mozilla dosn't appear in Add/Remove Programs, and the uninstaller must've left something behind...

    I tried deleting the Firefox folder as well, but after reinstalling Firefox 6.0, I continue to get a Run error message saying essentially that 5.0 & 6.0 aren't compatible. So, how can I remove all versions from all locations and start fresh?

    I tried deleting the Firefox folder as well, but after reinstalling Firefox 6.0, I continue to get a Run error message saying essentially that 5.0 & 6.0 aren't compatible. So, how can I remove all versions from all locations and start fresh?

  • HT5557 how can you remove all books from books purchased file

    how can you remove all ibook from purchased file

    When I connected my iPhone, it automatically synced right away. I did click on the iPhone button and saw the contents of my iPhone including the Books. When I clicked that 'Books' button. But since the book in question was not on my iPhone, it did not show up in the list so I could not select it like you suggested. Therefore I could not sync that book to my iPhone. Thanks for the help though.
    The good news is I did manage to get the book on to my iPhone.
    When her book came out for preorder about a year or two ago, I looked for it in the iTunes store and preordered it. About a week after it came out, I found what was basically the same book for a dollar more. ($7.99 and $8.99) I figured there must be something additional (features) in the $8.99 book. So I bought it too. As far as I could tell though, they were exactly the same. So I decided to hide one of them so they would not both show up in my Library. Anyway, I went to my iTunes/iBooks account and managed the hidden books area. I unhid the Demi book and then it showed up in my iCloud to download on my iPhone. Now they are both on my computer so I need to figure out which one is the other one and hide it. So then I can delete it from my computer just have the one that is on my iPhone on both systems. But at least I found a way to get a copy on my iPhone.

  • How can I remove the photos without deleting them from the album?

    I am making a book in Aperture 3.  I want to change some of the pages that I have put together, and want to remove some of the photos from some of the pages, to put them on another page.  How can I remove the photos without deleting them from the album?

    As a follow-up, I have found that clicking on the photo in the book also highlights the photo on the strip below.  So, if you then hit delete, you will delete the photo from both the book page and the album (which is the book, the way I have it set up).  If you only want to delete it from the book page, you then have to un-click the photo on the strip below, or both will be deleted.  This seems unwieldy.  I deleted 6 photos from a page and found all of them gone from the album.  The only way that I can see to keep them in the album is to then unselect them from the bottom strip after selecting them fro the page.  This seems to call for an extra step. 
    Nancy

Maybe you are looking for