How to search for upper/lower case using string using JAVA!!!?

-I am trying to write a program that will examine each letter in the string and count how many time the upper-case letter 'E' appears, and how many times the lower-case letter 'e' appears.
-I also have to use a JOptionPane.showMessageDialog() to tell the user how many upper and lower case e's were in the string.
-This will be repeated until the user types the word "Stop". 
please help if you can
what i have so far:
[code]
public class Project0 {
public static void main(String[] args) {
  String[] uppercase = {'E'};
  String[] lowercase = {'e'};
  String isOrIsNot, inputWord;
  while (true) {
   // This line asks the user for input by popping out a single window
   // with text input
   inputWord = JOptionPane.showInputDialog(null, "Please enter a sentence");
   if ( inputWord.equals("stop") )
    System.exit(0);
   // if the inputWord is contained within uppercase or
   // lowercase return true
   if (wordIsThere(inputWord, lowercase))
    isOrIsNot = "Number of lower case e's: ";
   if (wordIsThere(inputword, uppercase))
     isOrIsNot = "number of upper case e's: ";
   // Output to a JOptionPane window whether the word is on the list or not
   JOptionPane.showMessageDialog(null, "The word " + inputWord + " " + isOrIsNot + " on the list.");
} //main
public static boolean wordIsThere(String findMe, String[] theList) {
  for (int i=0; i<theList.length; ++i) {
   if (findMe.equals(theList[i])) return true;
  return false;
} // wordIsThere
} // class Lab4Program1
[/code]

So what is your question? Do you get any errors? If so, post them. What doesn't work?
And crossposted: how to search for upper/lower case using string using JAVA!!!?

Similar Messages

  • How to search for perticular substring in given string.

    Hi, Can any one tell me how to search for perticular substring in given string.
    example:
    I have to search for CA in given Order type it may be CA10 or CA15. Please Do the needful.

    Hi Aniruddha,
    check this...
    Data var string,
    var = 'India'.
    search var for 'Ind'.
    if sy-subrc = 0.    " var having ind
    Message 'Ind found' type 'I'.
    else  .            "var not having ind
    Message 'Ind not Found' type 'I'.
    endif.
    thanx
    bgan.

  • How to query free text and how to efficiently process upper/lower case

    Hi friends,
    I'm now have two questions need your helps.
    1, i want to query free text base on oracle semantic, i tried create a Full Text Index on object like ‘CREATE INDEX di_obj_idx ON data_integration(to_char(triple.GET_OBJECT())) indextype is ctxsys.context’, but i got an error 'DRG-11304:function-based indexes are not supported by this indextype’. it seems that can't specified a column with functions. so any way for this?
    2, base on some reasons, we need to query something ignores upper/lower. of course, we can use upper/lower functions, but the performance is very low. what my question is is there any functions can be used in SEM_MATCH table function or any way can give me the higher performance?
    best regards,
    steven
    Sep 9,2009

    Hope this helps
    import java.io.*;
    public class Copy {
    public static void main(String[] args) throws IOException {
    File inputFile = new File("farrago.txt");
    File outputFile = new File("outagain.txt");
    FileReader in = new FileReader(inputFile);
    FileWriter out = new FileWriter(outputFile);
    BufferedReader buff = new BufferedReader(in);
    String c;
    while ((c = buff.readLine()) != null)
    out.write(c.toUpperCase());
    in.close();
    out.close();
    }

  • How does lsmw control upper/lower case?

    I have a client that wants all text fields to be in upper case?
    How can we control this in lsmw (the only way we are loading data)?
    Thanks.

    In step 'Maintain field mapping and conversion' is where you define how to convert data. Have you tried converting the text to uppercase here?
    Thanks,

  • How to Search for a Date in a string having both characters and date

    Hi ,
      I have a requirement to search DATE in the String having Both Characters and DATE . Please kindly let me know as early as possible.
    Regards
    Anil Kumar K

    Try to use SEARCH command with the pattern, making the pattern as fine as it can, like if you have your date in the format 02/23/2007, you can give
    SEARCH STRING FOR ' //'. (assuming the date has at least a single blank before it)
    WRITE:  SY-SUBRC UNDER 'SY-SUBRC',
    SY-FDPOS UNDER 'SY-FDPOS'.
    SY-FDPOS is set to offset of the string from which you can get the date value
    Refer here
    http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb33cc358411d1829f0000e829fbfe/frameset.htm
    It would have been better if there is something like UNIX "regular expression" matching in ABAP

  • Search for a word in a string.

    Hello everybody,
    Could anybody help me how to search for a word in a string ?
    Example: I have a string as below:
    String[] weather = {"snow", "rain", "sunny", "temperature", "storm", "freezing"};
    And I have a sentence like this:
    "Today is a sunny day"
    I want to break this sentence to pickup the word "sunny" and search this word in String[] weather to see if they match. How could i do that?
    Thank you very much. I really appreciate.
    still_learn

    1 iterate through the strings in your array.
    2. use String.indexOf(...) to test if the query string is present in the string

  • Dynamic Search - Upper/lower case of Search Criteria

    Hi,
    If I enter a search criterion in lower case in the text box field of my dynamic search, the string gets automatically converted to upper case when I press 'Search'. Is there any way to retain the case of the search parameter value?

    Hi,
    the data types for the input fields of the search mask are of type STRING. There is no conversion done there.
    If the case changes it has to be done in the applicatgion logic of the view controller, most probably the EH_ONSEARCH().
    Another hot option is the data element that is used for the parameter. Does it allow lower case values?
    cheers Carsten

  • Upper Lower Case for Input Fields of ALV

    Hi,
    i have an ALV has some input fields columns. All values of input fields are upper case after entering something into that input fields (etc. airline -> AIRLINE).
    how to add upper lower case control to ALV? (etc. airline -> airline, AIRLINE -> AIRLINE)
    Thanks.

    Dear Narullah,
    The elements of your table consists of data types you can maintain in the SE11.
    The data type are based on a domain which you can maintain in SE11 as well.
    Just go to SE11 and check the domain which is behind the table field. On the tab "Definition" of the domain just checkmark "Lower Case". Afterwards the system does not translate your input to upper case automatically.
    If you use a SAP domain, you need to copy it to customer namespace, set the lower case flag, create a new data type based on your own domain and use it in the structure of your internal table.
    Does this help?
    Regards,
    Hendrik

  • How do i search for a photo album when i use the search facility on my iPad or iPhone it will not find photo albums of a given name can anyone help

    how do i search for a photo album when i use the search facility on my iPad or iPhone it will not find photo albums of a given name can anyone help

    Photo albums are not searched by Spotlight Search.  Go to Settings > General > Spotlight Search to see and reorder the available search items.
    For more details, see page 12 of the iPad iOS 5.1 User Guide

  • How to search for a particular element within a XML variable using studio?

    All,
    I am using studio 7.0 to develop a webbased application. In this, i need to access
    an oracle db using a WLAI Application View from my Workflow. I get some data back
    from Oracle as an XML variable and then apply an XPath statement to access the
    individual columns returned.
    My problem arises when there are no records in the db matching my criteria and
    an empty XML variable is returned to me from the app view. In these cases my
    XPath statement fails in studio causing an improper exit.
    Does anybody know how to check for content in a XML varaible using studio? So
    that if there is content i can proceed with XPath and if there is no content,
    then i will take a different route.
    Thanks in advance
    Regards
    Sri

    If I remember correctly, the adapter will return an XML document that contains
    XML elements for each row. You can just simply check the count of these elements
    with an XPath statement: ie. count(response/row)
    "Sri " <[email protected]> wrote:
    >
    All,
    I am using studio 7.0 to develop a webbased application. In this, i need
    to access
    an oracle db using a WLAI Application View from my Workflow. I get some
    data back
    from Oracle as an XML variable and then apply an XPath statement to access
    the
    individual columns returned.
    My problem arises when there are no records in the db matching my criteria
    and
    an empty XML variable is returned to me from the app view. In these
    cases my
    XPath statement fails in studio causing an improper exit.
    Does anybody know how to check for content in a XML varaible using studio?
    So
    that if there is content i can proceed with XPath and if there is no
    content,
    then i will take a different route.
    Thanks in advance
    Regards
    Sri

  • How to search for a certain cross reference using its name in FM 11?

    How to search for a certain cross reference using its name in FM 11?

    Well, thank you. I am only using Find dialog box. By "name", I'd like to give an example. The background is FM 11 structured. I have an element "xref" which is used to make cross reference. Now In Chapter 1, there is a sentence like "This is an ODU for ...". I made a cross ref of the word "ODU" to its full name "outdoor unit" in Chapter 2 (in the same book). After this, the word "ODU" in the sentence in Chapter 1 will no longer be a plain text. So I no longer can use the find dialog box to search for "ODU" because it is already an xref rather than text. I am not if it's clear.

  • How to search for the list of portal components that use a certain LOV?

    hi,
    does anyone know how to search for all of those portal components which use a certain other component?
    let's make it specific. how can i know which of the portal components (portal reports and forms, content folders, etc) are using any certain LOV?
    will really appreciate any hints.
    naqvi

    Please ask this question in the Oracle Text forum (formerly interMedia text). You will get the experts that work with it every day there.

  • Internal Order match-code fail becuase Upper-Lower case

    Hi
    I'need to search Internal Order using a piece of teh Order description.
    Unfortunately the description COAS-KTEXT is case sensitive, and the Order is not found if Upper/lower case rules are not respected. I Have create a new Z match-code, bust this has the same problem.
    Any Idea to solcve thsi issue ???
    Thanks for your help.
    Claudio

    Hello
    pls check OSS note 75233, is decribed the solucion you are looking for.
    Solution
    Check whether an F4 search for short text is required.
    You must then either allow for the fact that the selection criteria "short text" is case-sensitive, or you can change all the short text to uppercase. This change is then effective during all displays and entries of the short text for the order and cannot be reversed. Any information which is provided in lowercase letters is then lost.
    You should also consider creating an index for the field AUFK-KTEXT.
    If you want to change to uppercase letters, proceed as follows:
    1. Modify the table AUFK. The field KTEXT requires another data element with a domain in which the flag "lowercase letters" is not marked. The most effective solution is to copy the data element and the domains and in addition to the descriptions, change only flag "lowercase letters"
                  This change means that for overhead cost orders (transactions KO01, KO02) only short text in uppercase letters can be recorded. 
    2. To change the already existing database entries to uppercase letters run report RDOTXT2U which is contained in the standard program and the current version of which is shown below. Please read the documentation for this report.

  • How to search for a BADI in a transaction

    Hi All,
    Please let me know the steps to find a BADI for a transaction.
    Thanks,
    Jaffer Ali.S

    check this.
    u can find BADI's in different ways...
    1>First go to any transaction->iN THE menu bar SYSTEM->STATUS->Get the program name ->double click->u will go to the program attached to the tcode.Now search term will be CALL CL_EXITHANDLER.Now u will get list of BADI'S available..
    2>Goto SE24->Give class name as CL_EXITHANDLER->Display->double click on get_instance mathod->Now u will go inside the method->Now put break point on the cl_exithandler.Now go to any transaction code and pass dat..U will see that it will be stopped on the break point which u set on the cl_exithandler...In the exit name u can find list of badi's attached to the tcode..
    There are multiple ways of searching for BADI.
    • Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
    • Finding BADI Using SQL Trace (TCODE-ST05).
    • Finding BADI Using Repository Information System (TCODE- SE84).
    1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.
    Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.
    The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
    2. Start transaction ST05 (Performance Analysis).
    /people/alwin.vandeput2/blog/2006/04/13/how-to-search-for-badis-trace-it
    3. Go to “Maintain Transaction” (TCODE- SE93).
    Enter the Transaction VD02 for which you want to find BADI.
    Click on the Display push buttons.
    Get the Package Name. (Package VS in this case)
    Go to TCode: SE84->Enhancements->Business Add-inns->Definition
    Enter the Package Name and Execute.
    Here you get a list of all the Enhancement BADI’s for the given package MB.
    The simplese way for finding BADI is
    1. chooes Tcode Program & package for that Tcode.
    2. Go to Tcode se18
    3. Press F4
    4. search by package or by program.
    Regards
    Kiran Sure

  • AMs and PMs - how to search for small-caps?

    In my book I'm proofreading I have a mixture of (because I was undecided when I was putting it together):
    i 7.00 a.m.
    i 7.00 am
    i 7.00am
    I ran these three options past about twenty people this morning, 6 voted for the first, 8 voted for the second, 3 voted for the third, and 1 person and myself voted for the option I can't show properly here: small-caps: 7.00 AM. Then of course there was the wag who told me: "Why don't you just say '7 o'clock in the morning' "? And the complete ratbag who suggested, in the interests of avoiding confusion: "7.00 am o'clock in the morning before lunch at 0700 hours."
    Before I make them all the same format, which will very likely be small-caps, I want to make sure I can easily search for them so I can replace with an alternative style if I change my mind again later on.
    QUES: How do I search for "AM" and "PM" (spaces before and after) if they are formatted in small-caps? I can't use paragraph styles because the AMs and PMs appear in a variety of styles already.

    Thanks for all the hints. I'm going to try some of them to see how they work. I should make it clear though (my original post may have been unclear about this) that I was asking how to search for AM in small caps AFTER I had changed all time-formats to that form.
    As for why I asked for input: I treat my book a bit like a democracy and give people a chance to vote on certain aspects and make comments just in case they have a good idea that I hadn't thought of; but yes, I'm the boss, and in terms of votes mine counts for 95%. In this case, someone suggested using a colon -- which I have taken on board. So I will be using the time format 7:30 AM to see how it looks. But if I don't like it, I want to be able to find all the small-cap AMs and change them to something else in one go.
    My interest in time-formats has stirred some interest locally. My partner proof reads a walking club magazine and she received the latest edition lat night. She has never concerned about time formats before, but after my foray into different options, she came up with the following variety (the club has lots of reports that include times when walking trips start and end), even though she thought she had done a thorough job of proof reading:
    9 am
    9.00am
    9:00 am
    9:00am
    9.am
    9 AM
    9.00a.m.
    9.00 a.m.

Maybe you are looking for