Variable string output

I have searched tons of forums and cant seem to find code that will allow me to output the users string inputs to the dos screen.
An example of this would be.
Enter shopping items: Ham
another?: yes
Enter shopping items: Eggs
another?: no
Your list contains:
Ham
Eggs
here is my code:
System.out.println("This program will create a shopping list:");
String keepGoing = "yes";
String item = null;
Scanner keyboard = new Scanner(System.in);
for (int count = 1; count < 999 && keepGoing.equalsIgnoreCase("yes");count++){//ask for input, write it to a file
System.out.println("Please enter item #" + count + ":");
item = keyboard.nextLine();
inputItems.println(count + " " + item);//ask if you want to keep going
System.out.println("Do you wish to enter more items (yes/no)");
keepGoing = keyboard.nextLine();
System.out.println("Your shopping list contains: " + ); ***** Not sure what to put in the above ("Your shopping list contains: " + ) "******
Any help?

check the comments...
       // ...... (your other bits of code)
        // Use a boolean variable instead of a Stirng
        boolean keepGoing = true;
        // keep looping until user says 'no'
        while(keepGoing)
            // ...... (your other bits of code)
            System.out.println("Do you wish to enter more items (yes/no)");
            String temp = keyboard.nextLine();
            // anything other than yes is a no!
            keepGoing = temp.equalsIgnoreCase("yes");
         // ...... (your other bits of code)
        }hope this helps...
[email protected]

Similar Messages

  • Using SKPTSMTPMessage how to send a variable String?

    I am using SKPTSMTPMessage to send an email in the background but I need to send a variable string. I have tried putting a %@ in the text but it just sends the %@ and not a variable. Please Help?
    Hopefully, iCrazy23

    Did you ever figure out how to do this?  Because actually I'm trying to do pretty much exactly the same thing.  I'm actually having trouble even outputting the digital signal at all with my USB-6501.  I was initially trying to use DAQ Assistant, but then found out I probably shouldn't be using this and instead should be using the DAQmx individual functions.  I was directed by NI Support to look at the example "Gen Dig Pulse Train-Continuous.vi," but I haven't been able to figure out how to use this for my application.   For my project I  want to send a TTL signal to vavles that release fluids as well.  I have 3 2-way liquid releasing valves that I want to be synced so that only one is open at a time (for a user specified amount of time), and they open in a regular repeating sequence.  I also have another 3-way valve controlling a vacuum that I would like to be continuously pulsing, but for specified amounts of time (e.g., 3 seconds open, 3 seconds closed, and so on).
    I believe I can figure out the logic and the programming involved with figuring out the exact sequencing and timing manipulation, however, I'm having trouble just being able to output any digital signal with a varying time.  If you could offer any help on this, it would be greatly appreciated.  Thanks!

  • How do you make Robot type out a variable String?

    I don't know why I'm having an issue with this. I want the Robot class to type out a string one character at a time as if I were sitting at the keyboard and doing it myself. There will be many, variable strings to type. Here is what I tried to do and it fails miserably:
    private String myString = "example";
    // Loop for each character in the string
    for(int i=0; i<numChars; i++)
         // Get the current character
         myChar = myString.charAt(i);
         // Convert the character to a keycode
         myKC = (int)myChar;
         // Press the key, release the key
         myRobot.keyPress(myKC);
         myRobot.delay(10);
         myRobot.keyRelease(myKC);
    }When I run it, I get some unexpected output in the Notepad window I have open. Instead of it spelling out "example", it gives me something entirely different:
    e - instead of 'e', it gives me a '5'
    x - instead of 'x', it gives me nothing at all
    a - instead of 'a', it gives me a '1'
    m - instead of 'm', it gives me a '-'
    p - instead of 'p', 'F1' is triggered and the Notepad help window pops open
    l - instead of 'l', it gives me nothing at all
    e - instead of 'e', it gives me another '5'
    What am I doing wrong here? This was supposed to be easy...
    Edited by: ConQuesimo on Jan 19, 2010 12:06 AM

    ConQuesimo wrote:
         // Convert the character to a keycode
         myKC = (int)myChar;
    I don't see a keycode conversion here, keycodes for a to z are the same as ASCII, what I do see is an int conversion of what ever character set you have running on your computer. If I take your approach to conversion, then I get different codes on different keyboards/systems also. What I finally ended up doing is making a map for my keys and everything started working fine.
    For me, the problem expressed itself when I went from my Windows with MS-Keyboad to my Ubuntu with an earlier style MS-Keyboad. Character values and single character strings come out fine, but when I would try converting char to KeyCode as you have done, the results were not always what was desired. I've not looked into it to see what was actually causing the problem, ti was faster and easier just to make the map.

  • Calling Bpel Process From a Jsp(Need a string output instead of XML object)

    Hi
    I am calling a BPEL process(Synchrononus) from a JSP page, Where Bpel process calls a java web service.The output from Bpel process is returned as an XML object. I need the output in a string format.Please let me know the steps to get the string output.
    I also executed invokeCreditRatingService.jsp(from samples shipped with SOA Suite) that calls CreditRatingService bpel, but i was getting the following output where the rating value is printed as an XML object.
    Output:-
    BPELProcess CreditRatingService executed!
    Credit Rating is oracle.xml.parser.v2.XMLElement@9511c8
    Please let me know, what changes i need to make to get the string output.I followed all the steps given in "orabpel-Tutorial7-InvokingBPELProcesses.PDF" to execute credit rating jsp.
    We are using SOA Suite 10.1.3.1.0 version.Do I need to make any changes to the code, to make it work with this version.
    Thanks
    Vandana.

    The call payload.get("payload") returns, as you have observed, an XMLElement. You can simply convert the XMLElement into an XML string by using a DOMSerializer implementation. The following code is very useful for this purpose:
    http://javafaq.nu/java-example-code-432.html
    Best,
    Manfred

  • SQL Extract Variable String in Variable Position with Variable length from ntext field

    i want to extract a variable string from an ntext field. 
    Sample Data in Background_text (ntext)
    function changeFocus()  {         document.getElementById('skipContent').style.visibility = 'visible';         document.getElementById('flashContent').blur();        
    document.getElementById('skip').focus();  }  </script>    </head>  <body onload='hideDiv()'>    <div id="flashContent" align="center">     <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="700" height="440" id="Animation" align="middle">      <param name="movie"
    value="/assets/abc/images/abcdef.swf" />      <param name="quality" value="high" />
    I want to extract this data:      "/assets/abc/images/abcdef.swf"
    The string will always be preceded by value="     AND end in
    .swf"
    As a first attempt, I tried
    SELECT SUBSTRING([Background_text], CHARINDEX('value="/assets/', [background_text]) + 15, LEN(convert(varchar(max), background_text) -
    CHARINDEX('value="/assets/', [Background_text]) + 15) - 1)
    but I received this error
    Msg 245, Level 16, State 1, Line 1
    Conversion failed when converting the varchar value .......  to data type int
    This query won't completely accomplish what I want. Do you have a suggestion?
    Thanks.

    I'd add an extra bit of logic into the expression to only look for 'swf' AFTER the start of the string - it might be that you can guarantee that no occurrence of 'swf' will ever appear in the ntext, but who knows what might change in the future, and it's
    good practice to code defensively.
    SELECT
    SUBSTRING(
    Background_text,
    CHARINDEX('value="/assets/', background_text) + 6,
    CHARINDEX('.swf', SUBSTRING(
    Background_text,
    CHARINDEX('value="/assets/', background_text) + 6,
    LEN(cast(background_text as varchar(max)))
    ) + 4

  • Log the local variables (string type) to the database (SQL Server)

    i have a customized PreUUT callback so that my own VI gets the information from barcode. it contains serial number as well as other information. i am collecting the information into local variables of the PreUUT callback.
    Now i want to log the local variables (string type) to the database (SQL Server).
    i have a successful connection to the database and i am using a generic recordset schema.
    can anyone help me how to do it?
    also shall i have to create the corrosponding fields (columns) in the database? or is there any option in TestStand4.0 to do it?

    Hello i like original,
    After re-reading your original message, I think I might have a better understanding of what you would like to do.  I have included a few links to Knowledge Base and Developer Zone articles that should be very useful for you.  I have included these links below:
    Logging a New UUT Property to a Database in TestStand
    Logging a New Step Property to a Database in TestStand
    Creating a TestStand Database Schema from Scratch
    Thanks,
    Jonathan C
    Staff Application Engineering Specialist | CTD | CLA
    National Instruments

  • 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

  • Possible values for the variable string in "keysym. sym : string "

    The resource keysym for customizing the urxvt terminal has the syntax:
    keysym.<sym>:<string>
    As explained in the urxvt man page, <string> can contain "escape values".  Even though there are different examples of values for the variable <string> on the web, I was wondering if there is a place where I can find a comprehensive list of possible values for this variable. 
    (I tried to look for this information at the X man page -- as indicated in the urxvt man page -- but I couldn't figure it out. I wonder if my difficulty is due to the fact that I'm not sure what the expression "escape values" refers to...).
    Thanks!!

    pointone wrote:Maybe this will be helpful?
    Thanks a lot pointone for the link! I found many interesting things at this link. But I'm still not sure if I understand what the possible values of the variable <string> are. 
    From what I understand, the website you sent shows how to map a keycode to a keysym using the xmodmap utility.  However, it seems to me that the use of the rule
    URxvt.keysym.<sym>: <string>
    in the .Xdefaults maps a keysym to an action, given by the value of the variable <string>.
    Does this make any sense or am I missing something here?

  • UCCX 8.5.1 - Expression editor and a variable string value error

    I receive the followng error when trying to create a varialbe string value using the expression editor. The string value that I am trying to create is used with the Create URL Document Object. The popup error states 'Unable to parse expression: Couldn't repair and continue the parsing on token #ID 'FindCaseByCaseNumber' (line 1, col:24)'  The string value is "<Message MessageType="FindCaseByCaseNumber" Source="APIMessage" ReferenceNumber="1" NodeID="1" UserID="1"><CaseNumber>"05-CP-001842"</CaseNumber></Message>". The editor will not let me save the string value with quotation marks being used in the string value, exampe "FindCaseByCaseNumber". When I remove the quotation marks from the string value the editor will save the value but then the variable will not work.
    Has anyone encountered this same problem or know what to replace the "" to terminate the string value? I have tried brackets, but this does not work. Any suggestions are greatly appreciated!

    I found my answer. It appears that ${}, #{}, and ' will let you add a sub-variable to a variable string value.

  • Using include with variables (String)?

    Is it possible to include a *.jspf page from a variable (string)?
    I'm currently trying something like this, but I know it isn't quite correct (the PAGE string is already defined):
    <%@ include file="${PAGE}" %>I'm sure this is simple, but I'm pretty new to using JSP (I'm used to normal Java classes and the JSP syntax can be confusing at first...).
    Thanks!

    Ok, you're mixing up your EL expressions with scriptlet variables.
    These things are not the same.
    String PAGE = "pages/home.jspf"; decleares a scriptlet variable called PAGE
    You can normally access it using the scriptlet expression tag like <%= PAGE %>
    ${PAGE} is an EL expression.
    The EL variables are stored as attributes in the page, request, session and application scopes.
    So ${PAGE} will not give you the value of the scriptlet variable Page.
    ${PAGE} is approximately equal to pageContext.findAttribute("PAGE") in java.
    Probably the easiest fix would be to use a scriptlet expression rather than an EL expression.
    <jsp:include page="<%= PAGE %>"/>The better fix would be not to use any scriptlet code at all in your JSP, and maybe just use the JSTL conditional tags.
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <c:set var="PAGE" value="${requestScope.page}"/>
    <c:if test="${empty requestScope.page}">
      <c:set var="PAGE" value="pages/home.jspf"/>
    </c:if>
    <jsp:include page="${PAGE}"/>
    //or
    <c:import url="${PAGE}"/>Cheers,
    evnafets

  • Output variable string or number consecutively

    Hello,
    I have an input signal of telephone digits and I am trying to output the digits on a string or number indicator one by one as they come out so that at the end I would have a full telephone number. I understand the logic to program it but I can't quite get a way to do it visually in LabVIEW. Can you help?
    Thanks,
    LD

    I'm trying to detect an 11-digit telephone number coming from a cable. I'm using an NI USB 6008 unit to get the signal in and then work out the numbers. What I have right now is LEDs flashing up for each number from 0 to 9.
    I've attached my file for reference.
    I have two side questions I'd like to ask. First one is about DAQ Assistant: you know when you're setting up the DAQ Assistant, there's sampling rate, acquisition mode and samples to read parameters, what exactly is the samples to read parameter? The help information said that it's the number of samples specified to read for N Samples acquisition mode or the buffer size for Continuous sampling acquisition mode.
    I've got a bit confused about this samples to read parameter because when I tried putting it at high values like 10k, the output of the signal on the graph indicator was going really slow, like it would take snap shots at long intervals. And when putting the parameter at lower values, the signal becomes more continuous. The same actually goes for the sampling rate which is even stranger.
    The second question is actually related to the above question. Every digit is dialed (automatically) every 40ms - on the oscilloscope it's like 40ms of waves and then 40ms rest and then 40ms of waves again, so that's like a pulse going at 12.5 Hz. But the waveforms have frequency components within the range of 0.5k to 2k. So my question is what determines the values I'd want to use for the above parameters (if any)?
    Sorry for the shabby drawing
    Attachments:
    DTMF Decoder.vi ‏280 KB

  • Cfml-tags in string variables and outputting

    Hello,
    i'm implementing a small content-managment system in my
    web-application, based on cf-mx7.
    i have an html-editor for editing the web-content
    (FCKeditor). The content is then saved to the database.
    Now my application simpliefied loads the content from
    database and outputs it with
    <cfoutput>#mycontent#</cfoutput> where mycontent is the
    variable where the content is loaded to via cfquery-tag.
    So far so good. This works fine.
    Now i want to integrate some cfml-tags into the web-content.
    so that variabe mycontent contains html-code mixed with cfml-tags.
    but now the cfml-tags are only outputted to the browser as they are
    and are not processed by coldfusion.
    does anybody now how to implement that?
    may regards and thanks for your help
    mcdroemmel

    Hello,
    thanks for your answer.
    The reason is following:
    I show my content on a cfml web page using a
    <cfmodule>-tag, where the template-parameter identifies a
    custom-tag which gets the id of my content-object in the database.
    that tag has some additional funcitionality such a show links for
    editing the content when the actual user is the content-owner and
    show header and footers. It also loads the content, identified by
    the id of the content in the database, and outputs it using
    <cfoutput>#mycontent#</cfoutput>
    Now my intention is, that i want to use cf-tags in the
    content. with that i want to indirectly nest some
    <cfmodule>-tags. The result should be, that my content itself
    contains content-objects, but for that my first content has to
    contain that <cfmodule>tags
    i hope i could descripe to you what my intention is.
    regards
    mcdroemmel

  • Where clause as variable string

    I'm building a where clause as a string based on submited
    form variables. As long as the form variable is an INTEGER the
    query works fine. If it is a charcter or character string I get the
    error: "Incorrect syntax near 'n' " where "n" was the content of
    the form variable.
    for example, when the form variable form.explain value is
    "n":
    <cfset w= " WHERE t_QUESTIONS.q_section =
    dbo.t_sections.sect_ID ">
    <cfif form.explain neq"">
    <cfset w = w & " and t_QUESTIONS.q_explain =
    '#form.explain#' " >
    </cfif>
    <cfquery name="q" datasource="mydsn">
    SELECT t_QUESTIONS.q_ID, t_QUESTIONS.q_section,
    t_QUESTIONS.q_explain,
    t_sections.sect_name, dbo.t_sections.sect_ID
    FROM dbo.t_QUESTIONS, dbo.t_sections
    #w#
    </cfquery>
    returns the error: [Macromedia][SQLServer JDBC
    Driver][SQLServer]Line 5: Incorrect syntax near 'n'.
    Outputting the var #w# content to the screen shows:
    WHERE t_QUESTIONS.q_section = dbo.t_sections.sect_ID and
    t_QUESTIONS.q_explain = 'n'
    which looks perfect, and the query displayed in the debugging
    screen is:
    SELECT t_QUESTIONS.q_ID, t_QUESTIONS.q_section,
    t_QUESTIONS.q_explain, t_sections.sect_name, dbo.t_sections.sect_ID
    FROM dbo.t_QUESTIONS, dbo.t_sections WHERE t_QUESTIONS.q_section =
    dbo.t_sections.sect_ID and t_QUESTIONS.q_explain = ''n''
    This has to be something simple, I just can't figure out what
    it is. I really need to get this to work, anybody have a clue about
    what's going on? (this is MX7)

    There is a function called PreserveSingleQuotes( ) that
    should solve your problem. Check out
    http://livedocs.macromedia.com/coldfusion/5.0/CFML_Reference/Functions184.htm#1110445

  • Trap string output from resultset and pass the value to getSchema.

    I want to get the string ldb output frm the resultset and pass it to getSchemas(ldb).kindly let me know how to do it,right now it is throwing error like variable ldb might not have been initialised.
    public boolean Err_getSchemas() {
    boolean ret = true;
    try {
    System.out.println("**** Testing getSchemas Tests : - ");
    if(login()) {
    Statement stmt = con.createStatement();
    ResultSet rs;
    String ldb;
    rs = stmt.executeQuery("SELECT identifier FROM ldb_catalog");
    while(rs.next())
    ldb = rs.getString(1);
    //String ldb = rs.getString(1);
    //System.out.println("lll"+ldb);
    try{
    System.out.println("1.Testing DatabaseMetaData.getSchemas() with string ldb");
    ordbjava.jdbc.ordbMetaData dbmd = ( ordbjava.jdbc.ordbMetaData)con.getMetaData();
    ResultSet dbmdrst = dbmd.getSchemas(ldb);
    System.out.println(" Exception not thrown: TEST Pass ");
    dbmdrst.close();
    }catch(Exception ex){
    System.out.println("***JDBCMetaData.getSchemas() with string ldb failure***");
                   System.out.println(" Catch Exception"+ex );
    catch (SQLException e) {
    printExceptionStack(e);
    System.out.println("***ordbCollection Preparation Error Caught SQLException: " + e.getMessage());
    return false;
    finally {
    try {
    con.close();
    catch (SQLException e) {}
    return ret;
    }

    I want to get the string ldb output frm the resultset and pass it to getSchemas(ldb).kindly let me know how to do it,right now it is throwing error like variable ldb might not have been initialised.
    public boolean Err_getSchemas() {
    boolean ret = true;
    try {
    System.out.println("**** Testing getSchemas Tests : - ");
    if(login()) {
    Statement stmt = con.createStatement();
    ResultSet rs;
    String ldb;
    rs = stmt.executeQuery("SELECT identifier FROM ldb_catalog");
    while(rs.next())
    ldb = rs.getString(1);
    //String ldb = rs.getString(1);
    //System.out.println("lll"+ldb);
    try{
    System.out.println("1.Testing DatabaseMetaData.getSchemas() with string ldb");
    ordbjava.jdbc.ordbMetaData dbmd = ( ordbjava.jdbc.ordbMetaData)con.getMetaData();
    ResultSet dbmdrst = dbmd.getSchemas(ldb);
    System.out.println(" Exception not thrown: TEST Pass ");
    dbmdrst.close();
    }catch(Exception ex){
    System.out.println("***JDBCMetaData.getSchemas() with string ldb failure***");
                   System.out.println(" Catch Exception"+ex );
    catch (SQLException e) {
    printExceptionStack(e);
    System.out.println("***ordbCollection Preparation Error Caught SQLException: " + e.getMessage());
    return false;
    finally {
    try {
    con.close();
    catch (SQLException e) {}
    return ret;
    }

  • [OSB] Customize proxy with variable string

    Hi all,
    I've got this scenario:
    I need that my proxy service append a enviroment string to the output. I'm thinking to add this enviroment string on customization file. Is possible do this?
    For example i call a webservice that give me a link (ex. http://oracle.org), and i need that the proxy return link concat my string ("http://oracle.org" + mystring)
    Regards

    I got the same error with $accinfo/*:OutputParameters --->> BEA-382107: No value could be bound to variable: accsinf
    *$accinfo goes like this:*
    <get:OutputParameters      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://xmlns.oracle.com/pcbpel/adapter/db/SMS/GET_ACCOUNT_INFO/">
         <get:RESULTRECORDSET>
         <get:RESULTRECORDSET_Row>
         <get:BRANCH>87400</get:BRANCH>
    the XSLT:
    xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/db/SMS/GET_ACCOUNT_INFO/"
    <!-- Where the variable is defined -->
    <xsl:param name="v_accinfo"/>
    <xsl:template match="/">
    <inp1:something>
    <accounts>
    <!-- Here's how I use the variable: -->
    <xsl:for-each select="$v_accinfo/ns1:OutputParameters/ns1:RESULTRECORDSET/ns1:RESULTRECORDSET_Row">
    <xsl:if test="(ns1:BRANCH = $br) and ((ns1:ACC_NUM = $ac) and (ns1:CURRENCY = $cr))">
    <acc_description1>
    <xsl:value-of select="ns1:TYPE"/>
    </acc_description1>
    </xsl:if>
    </xsl:for-each>
    I tested the XSLT in JDeveloper. I just used the content of the $accinfo and $body from "Invocation Trace" (OSB Console > Proxy Service >Test) and the transformation works Fine. But I have problems when I use it in the Proxy Service's flow in OSB.
    Edited by: 849874 on Apr 5, 2011 6:43 AM

Maybe you are looking for

  • How to Scan a Paper Doc & Convert It with OCR to a Word Processing Format

    In an effort to save others with a similar need some time, I am posting a simple method of using he iPhone to scan a document and convert it, using optical character resolution, to an editable word processing format, usable on computers or iPhones an

  • Can't import into MS-Vista/Mcafee-error 3259-"Network connection timed out"

    My downloading is working except when importing music into iTunes. I have microsoft vista and use mcafee but get the msg error 3259-"Network connection timed out - help

  • Is there a way to undo autoflow?

    I want to put my photos in manually. Can I change it back?

  • Service Tax Register - Kind/Type Of Service

    Hello All, I am to create a Zee Report for Service Tax Register as there is no standard report for it. I am stuck at a place , I need to know which table contains the entry for " Kind Of Service" . I mean the service over which the Tax Implies. Has a

  • No Audio in Elements 7

    Uploading from a Sony HDR Sr12 camcorder in AVCHD. I have sound in all other programs but not when I need to edit with Adobe Premiere Elements 7. My system is a Dell 2.93 quad system with 6gig ram, 512 video ram and 1.28 T hard drives. System uses wi