Question on checking a string for letters. help!

im doing a method to check if a string given by the user contains something other then a alphabet. what i did was use the Character isLetter method and simply did a charAt(count) of the string given, problem is when i was testing my method i realize that if i spaced out the string such as "abc de" it would print out my error message for that method but it shouldnt print the error msg since it contains only letters. any suggestions on how to use the isLetter() and have it accept whitespace? the method works if i just did abcde but not abc de. thanks in advance

Try using
if (Character.isWhitespace(c) || Character.isLetter(c)){
// it is good
else {
// no good
}where c is your character. So this way you allow both white space and letter.

Similar Messages

  • To check the string for a particular character

    i want to check the string contains ',' (comma) or not. can anyone help me?

    i want to check the string contains ',' (comma) or
    not. can anyone help me?you can use 'indexOf' method at string object
    String s1 = "test,tet1";
    boolean bfind = s1.indexOf(',') > -1 or
    boolean bfind = s1.indexOf(",") > -1

  • Easy question about checking a string

    hi guys i have a problem that im sure most of you will know and im probably doing something silly, I have a record and am wanting to check the values in some fields so i have:
    IF Rec1.next_record = 'Renault' AND Rec1.prev_record != 'Vauxhall'
    the != part doesnt seem to be working, should i be using a different method to check if the string is not equal to the given text?
    Thanks.

    thats the problem then, the value is null, so you would think if i done
    if Rec1.prev_record = NULL it should work? though it doesnt appear to. Would you have any ideas on that?
    Thanks for the information, quite helpfull.

  • Check a String for a particular text

    Hi, I have a String variable.
    How do I check if this String has Something 'like' Apple 1?
    Eg:
    String name=null;
    Now the value in name can be apple 1 or apple 99 or apple 33. SO I need to put an IF statement where i want to say continue IF name is like "Appl 1

    String.find(Pattern)Dry. I think that's matcher.find(Pattern)

  • Question on "MacKeeper"..Thanks for the help!

    Thanks to the members who sent me info on MacKeeper...bought it anyways...yeah I know.
    and willl check  out Onyx too..

    yes.  you need to buy a Snow Leopard retail disc (online or from the Apple store) for $29 USD.  Then run software update to get to 10.6.8.  Then access the app store and download Lion, also $29 USD.  Make sure your mac meets the technical requirements by googling "snow leopard technical requirements" and then "Lion technical requirements".

  • Match the string for a particular format

    i want to chek the string for a particular format..
    lets say for ex ,
    i have to check the string for 6A1N format where A - Alphabets and N - Numbers.
    that means my string exactly contains 6 alphabets from a to z and one number from 0 to 9
    like this i want to check for two more fromats..they are..
    2A7N1A or
    9N1A

    koneru9999 wrote:
    will the pattern is helpful in my case?
    and i don't have any idea doesn't mean finsh reading all the API right?You need to study http://www.regular-expressions.info/ and then http://java.sun.com/docs/books/tutorial/essential/regex/ .

  • License for oracle Help

    I have a question about the licensing requirements for Oracle Help.
    I am writing the on-line help to support a commercial application which will be charged for. can I use Oracle Help for developing on-line help?
    Thanks.
    bai

    Hi,
    Q: I read the license text on the download page... I didn't see any reference to the rights to re-distribute the icebrowser that comes with the Oracle Help. Does one need to obtain a separate license with Icesoft the maker of IceBrowser ?
    Q: Related to a message posted earlier about Oracle's plan for Oracle Help... I can tell from the messages folks feel the Oracle Help has some advantages over Sun Java Help, and it can be considered as a replacement for Sun Java Help. However, in order to migrate from Sun Java Help to Oracle Help, it's important to understand the roadmap.. a roadmap will make it clear that Oracle is committed and helps users justify a migration.
    Q: Also, since Oracle is committed to Eclipse... what is going to happen to Oracle's commitment to Oracle Help, if people start building applications using the Eclipse Rich Client Platform and use the Eclipse Help system ?
    Thanks in advance for your responses,
    Edwin

  • Check string for two special characters back to back

    Hey all so I need to check if a string has 2 backslashes back to back ("\\"). So the string "\\computername\c$\file" would match but the string "C:\file\path" would not. I've tried contains, match, and like. I've tried the code
    below which does work but gives me a false positive when I have a string like this "\computername\file\path".
    $com = "\\computername\C$"
    if($com -match "\\"){
    Write-Host true
    }else{
    Write-Host false
    Thanks for any help!

    In Regex ^ matches the starting position of a string. \ is a special character in Regex so you need to escape it with another \, so since you want double backslash \\, you need to escape twice \\\\, so ultimately ^\\\\ reads, at the start of the string
     find \\
    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
    Don't Retire Technet

  • EBS search string for check number

    Hello Gurus
    My client is using MT940 FORMAT for EBS,requirement is in a bank statement we are having 10 transactions which are having the same amount for ex:rs.1000 for ten payment transactions. now system is not able to post the document when we import the bank statement.
    I wanted to use search string for check number,  note to payee in bank statement is check number.Please find the below refference
    /EI/400229001       010013
    0000010013
    Reference 010013
    How could i use search string for this i tried but im not getting the solution im getting the following error difference is too large F5 263.
    Appreciated for our help............
    Thanks a lot in advance...............

    Hi Paulo,
    Thanks for the reply. However i have the following setting and it still does not work..
    Mapping -> AB01
    When i do the simulation it shows the Number and the hits and mapping.
    In the Seach String use i have following settings:
    CC 1000
    Interpretation : ALL Interpretation
    Search String : TEST1 ( this is the name that i gave to above search string)
    Target : Posting RUle
    Active checked.
    But still when i upload the bank statement it is posting to Rule AB03 and not AB01
    Also when i try FEBSTS it says no document hits ???
    Your answer is greatly appreciated.

  • Checking for letters and numbers

    Guys, i need to check a String to see if contains either letters or numbers and nothing else. I know that there's certain function is could use like:
    1. isNum() - to check for numbers
    2. isChar()-to check for letters
    but the things is that i get error when i tried to use either 1 of these methods.
    So is there any other methods i could use to do this validation??
    Thx Guys

    Ooo.. i saw that 2 method too but it says that it onli accept character but not string and wat i wan to check is a String.

  • When I try to update my phone to ios 7 it says i need to update my itunes to 11.0.5, when i check my current version in help menu under check for updates it says I have the current 11.0.5 version.

    When I try to update my phone to ios 7 it says i need to update my itunes to 11.0.5, when i check my current version in help menu under check for updates it says I have the current 11.0.5 version. Even the downloader for the update doesnt show that i need to update.Help plzz????

    There is some kind of error. The new version of iTunes is 11.1, which although is not available via updates, it can be downloaded from the Apple website here:
    http://www.apple.com/itunes/download/
    After updating iTunes to the newest version you should be able to update your iOS
    EDIT: I just did that and it works

  • I am going to buy unlocked iphone 5.. i will be going to india nxt months and will stay there for a while... so my question is will i get warrenty in india.. and will there be any problem with using indian sims..?? thnx for the help..

    i am going to buy unlocked iphone 5.. i will be going to india nxt months and will stay there for a while... so my question is will i get warrenty in india.. and will there be any problem with using indian sims..?? thnx for the help..

    The warranty for the iPhone is not and has never been International.
    Warranty and support are ONLY valid in the country of origin.  The only exception is the EU where the entire EU is treated as one country.
    If the device will be used in India, buy it in India.
    An unlocked iPhone will work on any supported GSM carrier world wide.  The LTE portion of a US purchased, unlocked iPhone is unlikely to work outside North America as it does not support the appropriate bands used in other countries.

  • Tried to check on updates for CS6 64 bit - Received message saying application manager may be damaged - download and install new copy - when I try this I receive message ERROR 404 I have a PC - any help would be gratefully received - thanks - William

    Tried to check on updates for CS6 64 bit - Received message saying application manager may be damaged - download and install new copy - when I try this I receive message ERROR 404 I have a PC - any help would be gratefully received - thanks - William

    reset your preferences:
    dreamweaver:  http://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs4-cs5.html
    flash:  http://helpx.adobe.com/flash/kb/re-create-preferences-flash-professional.html
    indesign:  https://forums.adobe.com/thread/526990
    lightroom:  http://www.lightroomforums.net/showthread.php?14226-Resetting-%28or-Trashing-%29-the-Light room-Preferences-file
    photoshop:  https://forums.adobe.com/thread/375776
    if that fails, uninstall ps, clean (Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6) and reinstall.  then use the manual updates.

  • My friend set up my itunes account and they have forgotten the secret question and i need it for something on itunes HELP!!!

    my friend set up my itunes account and they have forgotten the secret question and i need it for something on itunes HELP!!!

    Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities

  • I got home today and got a message on Messages or IMessage and the Messages app would not open i restarted my computer and it had a question mark as the icon for the app. Help!?!?! What does this meen how can i prevent further damage or fix damage delt

    I got home today and got a message on Messages or IMessage and the Messages app would not open i restarted my computer and it had a question mark as the icon for the app. Help!?!?! What does this meen how can i prevent further damage or fix damage delt

    Is this what you see when you start up your MBP?
    http://support.apple.com/kb/ts1440
    Ciao.

Maybe you are looking for