Gathering string input

i know this is a very basic question but it is stumping me, my code for int,char etc (primatives) is as follows:
variableString = (char)System.in.read();System.in.read();System.in.read();when i try this:
variableString = (String)System.in.read();System.in.read();System.in.read();it wont work.
any help or an alternate solution would be great
thanks

when i try either of the examples u listed i get errors like:
Cannot find definition for class 'Scanner' and other errors where the buffered input is not regognized
i dont know if im missing anything but its not working 4 me, if possible could some one post a simple set of code that gets input from key board and echos it?
thanx

Similar Messages

  • Try It mode - string input

    In Try It mode can you have more than 1 string input? I've been playing around with it but without success. For example when the user is inputting text some users put in 1 space after a full stop, others use 2. This will be frustrating to the users. I see that you can add another input string but this only seems to work in Know It mode.
    Cheers.
    Edited by: 800719 on Nov 1, 2010 12:46 AM

    I am experiencing a silimar problem with the action area not showing the same in the See It or Try It mode as when looking at it in the developer. It gets moved up from the actual action area. Since your post was over 2 years ago and there hasn't been any other replies, I'm assuming no one knows of a fix. Please reply if you ever found a solution.

  • Use unvalidated string input fro Tyr it mode?

    I remember from the past I could set an option to "unvalidated string input"for Try it mode as well. Currently the default is set to unvalidate string input entered in Know it and pressing typing complete.
    I wonder if it still is possible to have the Typing complete option in the Try it mode as well.
    Kind regards,
    Sjoerd

    You probably want to post to one of the J2SE forums but I would expect that you would want to read a character at a time and echo it back yourself.
    You should probably check sourceforge.net and/or apache.org as I am sure there is already an implementation that you can utilize

  • Can formula node take string input and output string?

    I am wondering if the formula node can take string input variable and output string variable after calculation. otherwise I have to output integers and then use case structure to select different output strings, that is kind of redundant in coding.
    ping

    If you are just trying to read lines that have mixed formatting, you don't need any script nodes.
    Can you attach a tpyical flne and a description of the desired read operation so we have a better idea what you are trying to do? Do all lines have the same overall format?
    LabVIEW Champion . Do more with less code and in less time .

  • Multiple strings input to single string output

    Dear all,
    this program is needed for my demo simulation purposes, I'm creating several string inputs to show into a single string output updating (input strings are shown in each line). i attached the picture below, put 2 output strings w/c both doesn't meet my desired result:
    1.) 1st string output - replace the old string w/ new string. what i need is to maintain also the previous strings. the new string will go to the next line.
    2.) 2nd string output - although i got all the strings i needed, it only appears right after the while loop terminates, so i did not see the string inputs updating.
    i'm using LV 8.5.1., any help is appreciated... posting your correct code will be more appreciated.
    thanks in advance...
    Ivel R. | CLAD
    Solved!
    Go to Solution.

    here's my code for anyone to see the actual difference.
    thanks,
    Ivel R. | CLAD
    Attachments:
    update strings.vi ‏14 KB

  • Does "Open Vi Reference" work differently in 8.5 if a string input is wired to vi path?

    SO I was reading the upgrade notes to labview 8.5 and I noticed a change in the "Open VI Reference" function.  In 8.2 you can simply wire a string of the vi name to the vi path input of the function, and labview will open a reference to the vi already in memory.  But in 8.5 the relative paths have to be the same. 
    So say I have a vi in memory called window.vi.  Its real path is C:\test\window.vi.  And let's say its already in memory and its reentrant so I can call it by vi server.  I used to be able to just pass a sting containing "window.vi" to the vi path input of "Open VI Reference."  I like to do that because I already know the vi is in memory, and it is a big pain to get all the relative paths right between developement and deployed executable.  This way I don't have to worry about getting dozens of relative paths right for a bunch of support vi's when I build an installer.  Does this mean if I upgrade to labview 8.5 I'll have to change this every single place I did it and then rebuild every installer to include support vi's with relative paths to the exe that are the same as their relative paths to the main vi in the development environment?
    -Devin
    I got 99 problems but 8.6 ain't one.

    Well thank god for that.  It is too bad the upgrade notes give no mention of how this impacts the executable environment, since it certainly seems like the executable the biggest and most likely part of the impact.  I bet you'll still have a ton of people with relative paths that are wrong in the installed executable but right in development environment.  Previously they would have worked even though the relative paths were wrong, but now you'll see errors.  By the way, what will happen if they have a relative path in the development environment but in the installed executable they compiled all their vi's into a single exe.  Will it error?  Do they have to rebuild with those vi's included as support files?
    tst,
    Check out the notes.  I don't know if there is enough there to understand or misunderstand, but I get nervous when they say stuff like this.
    Open VI Reference Function
    In LabVIEW 8.0.x and 8.2.x, if the name of the VI from the vi path input
    matches the name of a VI in memory on that target, LabVIEW returns a
    reference to the VI in memory and LabVIEW does not load the VI specified
    in the vi path input. In LabVIEW 8.5, if the name of the VI from the vi path
    input matches the name of a VI in memory on that target but the paths
    differ, the Open VI Reference function returns an error.
    Message Edited by billings11 on 09-05-2007 01:01 PM
    -Devin
    I got 99 problems but 8.6 ain't one.

  • URGENT-CREATE A HTML FILE WITH AN STRING INPUT FROM THE RUNNING JSP

    I am designing a web page where the user enters a page after entering his/her login and password.The User should now be provided with a display page containing the servers that he has permissions for access.The servers that he has permissions are maintained in a database(a normal text file in UNIX).
    Till now the program has been complete for displaying the servers that are available to him.
    I need to create a HTML form containing these servers names in a check box so that when the user clicks thcheck box against the server name it should go to the server and get the password for the required server.
    THe intention from me is to create a HTML file that dynamically takes values from the running JSP means the server names as a string value to its input and then i can continue
    Please guide me in creating a HTML form based on the string output from the running JSP
    FileInputStream fs = new FileInputStream("/root/Auth_Application/User_Access_List");
    DataInputStream in1 = new DataInputStream(fs);
    int fl=0;
    while (in1.available() !=0)
    String str1=in1.readLine();
    StringTokenizer st1 = new StringTokenizer(str1);
    String usernam=st1.nextToken();
    if (usernam.equals(uname))
    String ip=st1.nextToken();
    String host=st1.nextToken();
    fl=1;
    out.println("<tr><td>                                                                                              "+ host + "</td><td> " + ip +"</td></tr>");
    if (fl == 0)
    out.println("YOU HAVE NO SEVRER IN YOUR PROFILE !");
    in1.close();
    The host string here is the server name
    the ip is the ip address of the server
    Need to input these values to another HTML page that contains the check box list of the servers .
    once these are clicked i think i can pass on this to another JSP and retreive passwords
    Please guide me in this

    FileInputStream fs = new FileInputStream("/root/Auth_Application/User_Access_List");
                                    DataInputStream in1 = new DataInputStream(fs);
                                    int fl=0;
                                    while (in1.available() !=0)
                                    String str1=in1.readLine();
                                    StringTokenizer st1 = new StringTokenizer(str1);
                                    String usernam=st1.nextToken();
                                    if (usernam.equals(uname))
                                    String ip=st1.nextToken();
                                    String host=st1.nextToken();
                                    fl=1;
                                    out.println("<tr><td>                                                                                              "+ host + "</td><td>          " + ip +"</td></tr>");
                                    if (fl == 0)
                                    out.println("YOU HAVE NO SERVER IN YOUR PROFILE !");
                                    in1.close();I feel sorry for the inconvenience that is caused as i am new to using these forums.
    I have here used a simple program to retreive the names of the servers that the users have acess to..
    I have here read the servername and server ip stored from a file in UNIX in the running JSP.Now i need to pass these string variables to HTML file and display it in a Check box format.the strings host and ip have to be passed to the input of the HTML file so that they can further be processed once they are clicked using another JSP.
    Can anybody please help me in Passing these strings from the running JSP and display it in a check box format

  • RKD_WORD_WRAP with string input

    hi all,
    I need to split a string with RKD_WORD_WRAP, but it seems it takes only chars as input, so I would like to do this: create a char variable dynamically as long as the string in input and then pass it to the RKD_WORD_WRAP. Can anybody please tell me how can I do it?  I think I should use field symbol but I don't know them very much.
    Thanks in advance.
    Gabriele

    J@Y wrote:
    > RKD_WORD_WRAP has a limitation to split at a maximum of 3 lines..I wanted you to know about it before proceeding...
    I used in this way with no lines but table for result for testing:
    DATA the_string(300) TYPE c VALUE 'Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura  ché la diritta via era smarrita. Ahi quanto a dir qual era è cosa dura 5  esta selva selvaggia e aspra e forte    che nel pensier rinova la paura! '.
    CALL FUNCTION 'RKD_WORD_WRAP'
      EXPORTING
        textline                  = the_string
       DELIMITER                 = ' '
       OUTPUTLEN                 = 15
    TABLES
       OUT_LINES                 = text_table
    with this output
    Nel mezzo del
    cammin di
    nostra vita mi
    ritrovai per
    una selva
    oscura  ché la
    diritta via
    era smarrita.
    Ahi quanto a
    dir qual era è
    cosa dura 5
    esta selva
    selvaggia e
    aspra e forte
      che nel
    pensier rinova
    la paura!
    so it works with many lines as need: they're just put in the table
    now I'll check for split_string FM working ...

  • How to cast a String input into Date variable?

    I am using JOptionPane.showInputDialog to ask user for a date input. This will be read in as a String. I need to pass it to a variable call date. And when I print date using JOptionPane, it should be shown as whatever the user keyed in in this format: 25/2/09. How do I do it?

    By the way, that's not casting. Casting is when you have a variable whose type is at a particular level of detail, and you assign it a different level of detail -- say, casting an int to a long, or a List to an ArrayList.
    What you want to do is convert one type to a completely different one. In particular, you're going to do that by using SimpleDateFormat to parse the String -- that is, SimpleDateFormat will read the string, pick out the individual parts that express the date, and create a Date object that corresponds to it.

  • How can I achieve good validation check on String Input?

    This is a portion of my code,am just starting to learn java programming.public class Thickness
    public Thickness(){
    public static void main(String[]args)
    int thickness=0;
    double length;
    String strL;
    strL=JOptionPane.showInputDialog(null,"Enter the length of your building:");
    length=Double.parseDouble(strL);
    while((length<4)||(length>12))
    JOptionPane.showMessageDialog(null,"Error!This Program only works for"+"\n"+"Building whose Length lies Between 4m and 12m:");
    strL=JOptionPane.showInputDialog(null,"Enter the length of your building:"+"\n"+"Note that Minimum Length is 4m:"+"\n"+"Maximum Length is 12m:");
    length=Double.parseDouble(strL);
    So that if the user enters a length outside the specified range of values the error message,"Error!This Program only works for"+"\n"+"Building whose Length lies Between 4m and 12m:" will be displayed and the program will prompt the user to re-enter the length.
    This validation check works perfectly as long as the input is double or integer,What I need now is to include a check to display an error message if the user inputs nothing or supplies a character (other than integer or double)as input.I want to be able to customise the error message,like having(JOptionPane.showMessageDialog(null,"Error!This is an invalid input:")).
    I know the compiler will also generate an error message if the user inputs a String instead of a double,but I want to be able to achieve this instead of the compiler doing it for me.
    pls I will be very happy if you can assist me with the code that would perform this check.
    Thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    length=Double.parseDouble(strL);Read the API. It tells you that it can throw some kind of exception if the input isn't valid. Then it's up to you to properly handle the exception. If you don't handle it, the VM does by displaying the exception and terminating the app.
    API docs:
    http://java.sun.com/j2se/1.5.0/docs/api/index.html
    Tutorial on exceptions:
    http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html

  • Mutliple Query String input to APEX RESTful Services

    Does Oracle APEX (latest version via APEX Listener) support passing in multiple query string parameters to support a restful service query? E.g.
    http://ofmindus.induscorp.com:7000/apex/servicetest/animals/dogs/spot
    http://ofmindus.induscorp.com:7000/apex/servicetest/animals/dogs?name=spot
    http://ofmindus.induscorp.com:7000/apex/servicetest/animals/dogs?name=spot?location=Maryland
    As you can see the progression above, the last url will query a dogs table using where name = 'spot' and location = 'Maryland'. Is this possible? If so can someone explain how to setup the URI/Bind Variables? Also, if its possible, do I need templates to support each variation of the input that is possible using a priority setting to help APEX pick the right query to execute?
    Edited by: user2777903 on Feb 11, 2013 10:19 AM

    Hi Nilesh,
    We tried to connect to Oracle Cloud Database using the way you suggested above, but unfortunately it is not working as well.
    Can you let us know the authentication process with Oracle Cloud Database? We found in documentation that it uses OAM (Oracle Access Manager) for authentication. Can you tell us a bit about that? That will be extremely helpful.
    Thanks,
    - Neeraj

  • Classes and subclasses given as String input - question

    Hello, I am new in Java so please don't laugh at my question!!
    I have a method as the following and I am trying to store objects of the type Turtle in a vector. However the objects can also be of Turtle subclasses: ContinuousTurtle, WrappingTurtle and ReflectingTurtle. The exact class is determined by the String cls which is input by the user.
    My question is, how can I use cls in a form that I don't have to use if-else statements for all 4 cases? (Imagine if I had 30 subclasses).
    I have tried these two and similar methods so far but they return an error and Eclipse is not of much help in this case.
    Simplified methods:
    //pre:  cls matches exactly the name of a valid Turtle class/subclass
    //post: returns vector with a new turtle of type cls added to the end
    private Vector<Turtle> newturtle(Vector<Turtle> storage, String cls){
         Turtle t = new cls(...);
         storage.add(t);
         etc.
    private Vector<Turtle> newturtle(Vector<Turtle> storage, String cls){
         Turtle t = new Turtle<cls>(...);
         storage.add(t);
         etc.
    }Thanks for your help.
    p.s.: I didn't know whether to post this question here or under Generics.

    a Factory is atually very simple (100x simpler than reflection).
    example:
    class TurtleFactory
      public Turtle makeTurtle(String typeOfTurtle)
        if (typeOfTurtle.equals("lazy") { return new LazyTurtle(); }
        else if (typeOfTurtle.equals("fast") { return new FastTurtle(); }
        <etc>
    }While at first this doesn't look any better than your original problem, what we've done is made a class that is responsible for all the types of turtles. This will also benefit in case some turtles need initialization or need something passed to their constructor. You encapsulate all that knowledge in one place so you rcode doesn't become littered with it else ladders.

  • Reading String input?

    So the other day I thought I might go ahead and try to make a few simple programs to see if anything I have learned is soaking in. I did a few math ones, which were easy enough, but then I tried to do a password program. It was easy enough to write, but the thing is I could only do it with numbers. Although thats alright, I was aiming to do one with Strings rather than ints. Thing is I have no idea how to take the input of a String like an int would (readInt). Heres my short password program involving just ints if it helps any:
    package OtherStuff;
    import acm.program.ConsoleProgram;
    import java.util.*;
    public class stringPassword extends ConsoleProgram {
    public void run() {
         int password = 2256;
              while (true) {
                   int input = readInt("Enter a password: ");
                   if (input == password) {
                        println("Password accepted");
                        break;
                   if (input != password) {
                        println("Password not accepted\n");
    }So all in all, how can I take the input of a String and use it in the same way I use ints in the code above?

    jverd wrote:
    ldilley wrote:
    jverd wrote:
    ldilley wrote:
    jverd wrote:Reference values, actually.The values stored in reference variables are memory addresses.They may be implemented as such, but it's not required by the spec. The JLS has no concept of a memory address.Required or not, it is what it is. Nobody was questioning specification requirements; albeit the JLS does make mention of addresses of objects. I come from a C background and the concept of memory addressing is how I describe it. Terminology tends to bleed over if you use multiple languages. Regardless, you are wanting to debate about semantics. Let us not digress from the OP's inquiry.It was specifically for the OP's benefit that I brought it up. I've seen too much confusion from people blurring the lines between specification and implementation, and trying to apply concepts from other languages beyond where there's any similarity or any usefulness in doing so.
    A reference is simply an opaque value that is used to locate and object. The fact that it's an address is irrelevant. What is it an address of? In current Sun JVMs, I believe it's an address of a pair of pointers. One might say something like, "If you're familiar with addresses or pointers in other languages, you can think of a Java reference as the memory address of the object, even though that's not strictly speaking what it is." I don't see any value in telling a noob that it IS an address though.Making mention of memory addresses is certainly not beyond similarity or usefulness in the scope of this context if that is what you are implying. I do not believe it is irrelevant (I see from many of your posts that you like this word) to help Cypher understand what is going on conceptually. The "cubby holes" visualization of memory certainly helped me in my programming courses. The fact is, there are many people who can use the Web(tm) proficiently without knowing the related RFCs. The same applies to the JLS and programming with Java. It may help if you want to be a pedantic Java lawyer. However, knowledge of this document is definitely not required to use the language productively. So, inversely, I do not see the value in being overly concerned with semantics and the details of the JLS as it could be too restrictive and confuse "noobs".
    In fact, there are several college-level textbooks that explain reference variables in terms of memory addresses. "Java Programming: From Problem Analysis to Program Design" by D. S. Malik is one such book. So, again, this is certainly not irrelevant by any means.
    Regards,
    Lloyd D.

  • Check string input

    I tried to use pattern class to check user's input, here is the code
    public boolean InputCheck()
    String REGEX,REGEX_S;
    Pattern pattern;
    Matcher matcher;
    REGEX_S = "\n";
    Pattern p = Pattern.compile(REGEX_S);
    String[] items = p.split(data); //data is a string
    //first try to use split() to split string data to lines
    for(int i=0;i<items.length;i++)
    //then for each line of data ,check if it's ok for the format
    REGEX="^(-?\\d*)\\s(-?\\d*)$";
    pattern = Pattern.compile(REGEX);
    matcher = pattern.matcher(items);
    if (matcher.find()==false){
    return false;
    //if one line not, reture false
    can any one can tell me what's wrong with this code, cos the compiler keeps say ing there is a missing return statement,thanks

    This is because the return statement IS missing =P
    public boolean InputCheck() {
        String REGEX, REGEX_S;
        Pattern pattern;
        Matcher matcher;
        REGEX_S = "\n";
        Pattern p = Pattern.compile(REGEX_S);
        String[] items = p.split(data); //data is a string
        //first try to use split() to split string data to lines
        for(int i=0;i<items.length;i++)
        //then for each line of data ,check if it's ok for the format
            REGEX="^(-?\\d*)\\s(-?\\d*)$";
            pattern = Pattern.compile(REGEX);
            matcher = pattern.matcher(items);
            if (matcher.find()==false){
            return false;
            //if one line not, reture false
        return true; // <----- you've missed this!
    }

  • Modifying the search form so it appends the '%' to String input fields

    Hi guys,
    How can I modify the search form to search for '%'sometext'%' instead of just sometext for input fields that take string type as input; not programmatically!

    Hi,
    you would have to do this one way or the other. Either in the managed bean (which then passes the search input to the underlying model) or in the business services (ADF BC for example)
    Frank

Maybe you are looking for

  • New MBP and memory

    It's been 5 yrs since my last laptop, so ready to get the new MBP. One question. 4G memory is quite a hit through Apple, but there are vendors out there ( eg Crucial) that charge about 1/2 that amount. Some time ago, Apple lowered it's price on memor

  • Goods Receipt reversal

    HI Following error is coming in goods receipt reversal account determination for entry dsds prd bs01_zc01 not possible, dsds-company code,bs01-plant,zc01-valuation class,why system asking to assign gl account in obyc for prd,(price difference account

  • My SkypeToGo number is always busy

    My Skype to go number is always busy.  I changed the number and it is still busy when I try to dial

  • Problem with detuning the song

    hello, I am using logic pro x and I need to detune an audio file (scientist- by coldplay) to play it along with my stadard tuned piano. I can't understand the pitch corrector - every time I try to detune it, sound is strangely ''elongated" and sounds

  • PhotoShop ASE ver 3 HELP file

    Anyone know where I can get this file? There is a link posted on: http://www.adobe.com/products/photoshopalbum/starter.html but it only results in an error - ver 2 no longer available........