Adding integers to strings

is there a way to put integers in strings?
like in the following script putting the string values in characters is there a way to put in numbers instead?
class Sid {
public static void main(String[] arguments) {
String heads = "tweleve";
String noses = "thirteen";
String organs = "zero";
String guess = "twenty-five";
System.out.println("you have " + heads + " heads and " + noses + " noses");
System.out.println("The computer guesses you have " + guess + " limbs");
organs = "twenty-five";
System.out.println("Answer: \n\t" + organs.equals(guess));
System.out.println("in total you have:\n\t twenty-five limbs!");
System.out.println("hmm.. how many characters are there in twenty-five?");
int length = organs.length();
System.out.println("there are " + length + " charachters in " + organs);     
}

Since everything is hard-coded anyway, just hardcode numbers.
You might want to think about storing all numbers in numeric-typed variables (like, ints) and then, if you really need numbers spelled out textually, pass them through a utility method to translate numbers to text descriptions of numbers immediately prior to output.

Similar Messages

  • Adding to a string array

    hi,
    seem to be having some trouble adding to a string array of names
    im trying to take a name from a text field and add it to the array
    help would be much appreciated
    this is the string array
    String[] AuthorString =     {"John Grisham","Agatha Christie","Nick Coleman","Scott Sinclair"};which is loaded into
    public void fillArrayList(){
         for(int a=0; a<AuthorString.length; a++) {
         AuthorList.add((String)AuthorString[a]);
                         }i then try and add to this using
    public void AddMember(){
         String temp = (String)AuthorField.getSelectedItem();
         for(int a=0; a>AuthorList.size(); a++) {
         String temp = (String)AuhtorList.get(a);
              AuthorString .addItem(temp);
          }can anyone see any problem with this, or am i doing it the completely wrong way

    Also, your "for" loop's test condition is backwards. It should use "less than":
    a < AuthorList.size()

  • Preventing select-string from adding additional undesired strings in the output file

    Hi friends
    in PS 4.0 i am trying to write a function which
    step1: export the list of all eventlogs ----> wevtutil el > "$home\documents\\loglist1.txt"
    step2: deleted the following two lines from loglist1.txt
    DebugChannel
    Microsoft-RMS-MSIPC
    ( the reeson of deleting these two lines is wevtutil cl command, can't clear these two evenlogs among approximately 1000 logs)
    in fact via select-string with -pattern -notmatch parameters, we select anything except these two line
    step3:  pastes the select-string contents into the same file ("$home\documents\loglist1.txt") or into new text file (for example
    "$home\documents\loglist2.txt")
    here is my code:
    function MycleareventsAll {
    cls
    Wevtutil el > "$home\documents\loglist1.txt"
    $mycontents = select-string "$home\documents\loglist1.txt" -pattern DebugChannel, Microsoft-RMS-MSIPC -NotMatch
    cd "$home\documents\"
    $mycontents | out-file loglist2.txt"
    # also i tried ---> $mycontents | set-content "loglist2.txt"# also i tried ---> $mycontents | set-content "loglist1.txt"
    but the problem is, in addition of deletion, unfortunatelly additional strings (filepath, filename, line number) are added into the final text file so wevtutil will fail clearing logs listed in text file.
    here is contents of the final text file
    C:\Users\Administrator\documents\loglist.txt:1:Analytic
    C:\Users\Administrator\documents\loglist.txt:2:Application
    C:\Users\Administrator\documents\loglist.txt:4:DirectShowFilterGraph
    but i need the contents be the same as original file without that two specific line:
    Analytic
    Application
    DirectShowFilterGraph
    i searched but i didn't find a way to prevent select-string cmdlet from adding these edditional strings
    (filepath, filename, line number) into output file while keeping the original contents.
    note: -quiet parameter is not what i want. it removes all contents & simply inserts a true or false.
    any help? 

    don't forget that Guys here know the basics of security such as clearing event logs & ...
    how odd if you don't know this.
    clearing all events is useful in test environment for example when i ma teaching my students & need to see all newly created events & work on them
    Then you are teching your students how not to use an event log.  We use filters and queries to access event logs.  We also use event log CmdLets in PowerShell.  WEVTUTIL is ok but it does not marry wellwith PowerShell as you have seen.
    I have found very few people who are not certified in WIndows administration that know much about eventlogs when it should be a ver important part of administration.  PowerShell has mmade EL management much easier but few take the time to learn how
    to use the EL support in PowerShell.
    I see no point inclearing event logs.  It accomplishes nothing.
    ¯\_(ツ)_/¯
    oh your are introducing me filters & queries in event viewer !! please stop Laughing me this way.
    your problem is you judge about people's knowledge & you persist on your absurd judgments.
    look at your sentence:
    "Then you are teaching your students how not to use an event log" 
    where from you tell this? have you been present in my classes to see what i teach to my students?
    have you seen that i told to my students not to use event viewer?
    my goal of clearing events is related to myself. it's non of your businesses.
    people are not interested to here concurrent irrelevant advises from you like a grandmother. they are searching for a solution. their intent of doing tasks is not up to you.

  • Powershell script error adding integers

    Hi All, I am trying to add integers but the script is not running. I am using variable "a" with the same line of thinking as
    $arg in $args
    $a in $as
    #  create a script thats adds numbers using foreach
    # put an if statement if the numbers are not valid
    My script begins here:
       set-psdebug -strict
        $total = 0
    foreach($a in $as)
                   if ( $a -as[int] -eq $null)
                { Write-host "this is not a valid number"
                    exit 1
                    $total += $a
                  Write-host "The total is $total"
    I am calling my script with the following line: .\finalexam\foreachadd.ps1 6 6 i
    The error is :
    The variable '$as' cannot be retrieved because it has not been set.
    At C:\cmd.practise\finalexam\foreachadd.ps1:8 char:15
    + foreach($a in $as)
    +               ~~~
        + CategoryInfo          : InvalidOperation: (as:String) [], RuntimeException
        + FullyQualifiedErrorId : VariableIsUndefined
    Thank-you
    SQL 75
    (LearningPowerhsell)

    You need to go back and study the very initial basics of PowerShell.  You are repeatedly guessing wrong and misunderstanding how this works. Without the fundamentals you will be forever lost.
    Try to understand why and how the following works.  Read the basics of using PowerShell variables and loops.
    $as=1,2,'x',4,5,'z'
    $total=0
    foreach($a in $as){
    if($a -as [int]){
            $total+=$a
    }else{
            Write-host "$a cannot be converted to a valid integer 32"
    Write-host "The total is $total"
    You also need to learn how to format your code.  Tat would make it easier for you too see your mistakes.
    \_(ツ)_/

  • Adding to a string name

    I need to getthe int count added to the name of an int rand.
    is this possible? rand + count = input.getUserInput("Answer");?
    public class jepmain {
          * @param args
         public static void main(String[] args) {
              int i = 0;
              String quitornot = "";
              getInput input = new getInput();
              int count = 0;
              jebquestions trivia = new jebquestions();
              System.out.println("-----------------------------------------");
              System.out.println("Trivia game!");
              System.out.println("by ");
              System.out.println("-----------------------------------------");
              System.out.println("Rules: Put caps where caps are needed, no commas, no dashes, just letters and numbers");
              System.out.println("The game keeps going until you get one wrong");
              while (i == 0) {
                   int x = 0;
                   while (x == 0) {
                   count++;
                   int rand = (int) (Math.random() * trivia.questions.length);
                   System.out.println(trivia.questions[rand]);
                   String answ = input.getUserInput("Answer");
                   if (answ.equals(trivia.answers[rand])) {
                        System.out.println("Correct");
                        x=0;
                   else {
                        System.out.println("wrong");
                        x--;
                   //alows the user to play again
                   quitornot = input.getUserInput("Do you want to play again[yes, no]");
                   if (quitornot.equals("yes")) {
                        i = 0;
                   if (quitornot.equals("no")) {
                        i++;
                        System.out.println("Thank you for playing the trivia game");
                        System.out.println("by ");
                        System.out.println("Goodbye");
    }thanks

    sys5 wrote:
    I need to getthe int count added to the name of an int rand.
    is this possible? rand + count = input.getUserInput("Answer");?No you don't, trust me. What you need is an array.

  • Adding a line (String text) to a file ,only if it is not present in the

    Please tell me the java code to add a String line to a file.
    The condition is the string to be added should not be present in the file
    Thanks in advance

    Hi ,
    The one simple solution is you can read the file in a string.
    The check the string you want to insert in the string so formed.
    By using
    int if((str.indexOf("String to be inserted"))!=-1)
    //Insert in the file
    else
    //dont Insert in the file
    Thanks & Regards
    Pradeep

  • Count integers in String array

    String[] s= {"xx","yy","34","35","46"};
    i want to count the integers in that String array.
    output: 3
    Can any one suggest me how to get that one.

    Try it again with this String in your
    array:"2147483648"
    Ok if you have to account for very large integers then you could use the following:
    String[] array = {"xx","yy","34","35","46", "2147483648"};
    int count = 0;
    for (String s : array) {
         boolean numericOnly = true;
         for (char c : s.toCharArray()) {
              if (c >= 48 && c <= 57) {
                   // Int value
              else {
                   numericOnly = false;
         if (numericOnly)
              count++;
    System.out.println("" + count);

  • How to convert an array of Integers into String

    So how can an array of integers be converted into a string?
    As I do not have a javac with me now, I hope you guys could help.
    Can it be done this way:
    int [] value = new int[] {2,3,4,5,6,7}
    String strValue = "";
    for (i=0; i<value.length-1; i++)
    strValue += value;

    Instead of working with Strings, I would suggest you use a StringBuffer. It will improve memory utilization.
    Like this:
    int [] values = new int[] {2,3,4,5,6,7};
    StringBuffer sbTmp = new StringBuffer();
    final int size = values.length;
    for (i = 0; i < size; i++) {
    String intStr = Integer.toString(values);
    sbTmp.append(intStr);
    String strValues = sbTmp.toString();

  • Can you control a URL in eloqua from being adding the query string??

    If I am inserting a URL in an email, i cant seem to stop eloqua from adding extra parameters in the form of query string in eloqua.
    I want to make this happen because the URL doesnt seem to work if we add any extra parameter using query string.

    I've tired doing this and it did not work for me. However, I was able to find a solution that helped me a whole lot.
    After running all test runs - I found a solution that helped me take off the extra parameters that Eloqua adds to all URL's.
    I created my urls without placing "http://" or "https://" or http://www." or "https://www." and that helped take off all tracking.
    Re: Use of tinyUrl

  • External tools - adding DB Connection string gives error

    I'm using SQL Developer 1.2.1.32.13 on Ubuntu 7.10. Whenever I try to add the "DB Connection String ${sqldev.conn} to the argument list of an external tool I get the error listed below. I searched this forum and don't see anything regarding this.
    java.lang.NullPointerException
         at oracle.dbtools.raptor.macros.ConnMacroExpander.expand(ConnMacroExpander.java:25)
         at oracle.ide.externaltools.macro.MacroExpander.getSampleExpansion(MacroExpander.java:134)
         at oracle.ideimpl.externaltools.ui.MacroPickerImpl.updateSample(MacroPickerImpl.java:128)
         at oracle.ideimpl.externaltools.ui.MacroPickerImpl.updateDetails(MacroPickerImpl.java:173)
         at oracle.ideimpl.externaltools.ui.MacroPickerImpl.mav$updateDetails(MacroPickerImpl.java:73)
         at oracle.ideimpl.externaltools.ui.MacroPickerImpl$DetailUpdateListener.valueChanged(MacroPickerImpl.java:486)
         at javax.swing.JList.fireSelectionValueChanged(JList.java:1765)
         at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1779)
         at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
         at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:147)
         at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:194)
         at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:388)
         at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:398)
         at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:442)
         at javax.swing.JList.setSelectionInterval(JList.java:2035)
         at javax.swing.plaf.basic.BasicListUI$Handler.adjustSelection(BasicListUI.java:2721)
         at javax.swing.plaf.basic.BasicListUI$Handler.mousePressed(BasicListUI.java:2677)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:263)
         at java.awt.Component.processMouseEvent(Component.java:6035)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3983)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
         at java.awt.Dialog$1.run(Dialog.java:1039)
         at java.awt.Dialog$3.run(Dialog.java:1091)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Dialog.java:1089)
         at java.awt.Component.show(Component.java:1419)
         at java.awt.Component.setVisible(Component.java:1372)
         at java.awt.Window.setVisible(Window.java:801)
         at java.awt.Dialog.setVisible(Dialog.java:979)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ideimpl.externaltools.ui.MacroPickerImpl.runDialog(MacroPickerImpl.java:283)
         at oracle.ideimpl.externaltools.program.ExternalProgramOptions.runMacroPicker(ExternalProgramOptions.java:429)
         at oracle.ideimpl.externaltools.program.ExternalProgramOptions.doBrowseArguments(ExternalProgramOptions.java:417)
         at oracle.ideimpl.externaltools.program.ExternalProgramOptions.mav$doBrowseArguments(ExternalProgramOptions.java:57)
         at oracle.ideimpl.externaltools.program.ExternalProgramOptions$ActionDispatcher.actionPerformed(ExternalProgramOptions.java:492)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6038)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
         at java.awt.Dialog$1.run(Dialog.java:1039)
         at java.awt.Dialog$3.run(Dialog.java:1091)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Dialog.java:1089)
         at java.awt.Component.show(Component.java:1419)
         at java.awt.Component.setVisible(Component.java:1372)
         at java.awt.Window.setVisible(Window.java:801)
         at java.awt.Dialog.setVisible(Dialog.java:979)
         at oracle.bali.ewt.wizard.WizardDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.wizard.WizardDialog.runDialog(Unknown Source)
         at oracle.ideimpl.externaltools.ui.ExternalToolsWizard.runEditWizard(ExternalToolsWizard.java:230)
         at oracle.ideimpl.externaltools.ui.ToolListPanel.doEditCommand(ToolListPanel.java:614)
         at oracle.ideimpl.externaltools.ui.ToolListPanel.mav$doEditCommand(ToolListPanel.java:80)
         at oracle.ideimpl.externaltools.ui.ToolListPanel$ButtonListener.actionPerformed(ToolListPanel.java:736)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6038)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
         at java.awt.Dialog$1.run(Dialog.java:1039)
         at java.awt.Dialog$3.run(Dialog.java:1091)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Dialog.java:1089)
         at java.awt.Component.show(Component.java:1419)
         at java.awt.Component.setVisible(Component.java:1372)
         at java.awt.Window.setVisible(Window.java:801)
         at java.awt.Dialog.setVisible(Dialog.java:979)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ideimpl.externaltools.ui.ToolListPanel.runDialog(ToolListPanel.java:283)
         at oracle.ideimpl.externaltools.ExternalToolsController.handleEvent(ExternalToolsController.java:18)
         at oracle.ideimpl.controller.IdeActionHook$MetaClassController.handleEvent(IdeActionHook.java:272)
         at oracle.ide.controller.IdeAction.performAction(IdeAction.java:551)
         at oracle.ide.controller.IdeAction$2.run(IdeAction.java:804)
         at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:823)
         at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:521)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1216)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1257)
         at java.awt.Component.processMouseEvent(Component.java:6038)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

    Since posting, I have moved to 1.5 but still have problems. Also, I am using Linux not Windows. For testing purposes I set up an external tool called "echo" with the following configuration:
    Program executable: /bin/echo
    Arguments: TERM:${env:var=TERM} sqldev.conn:${sqldev.conn} sqldev.dbuser:${sqldev.dbuser}
    Run Directory: /bin
    I have added the tool to "Tools Menu", "Navigator Context Menu" and "Code Editor Context Menu"
    Enabled is set to "Always"
    If I highlight the a connection and then right click, and select "echo" the following is displayed in the log:
    /bin>
    /bin/echo TERM: sqldev.conn: sqldev.dbuser:
    TERM: sqldev.conn: sqldev.dbuser:
    In order to get any of the values populated I have to expand not only the connection so that all the items (Tables, Views, Indexes, etc) are displayed but also one of these sub items as well. If I expand tables and then right click on any given table I will finally get some output from my echo command:
    /bin>
    /bin/echo TERM: sqldev.conn:jdbc:oracle:thin:@db.server.domain:1526:prod sqldev.dbuser:
    TERM: sqldev.conn:jdbc:oracle:thin:@db.server.doamin:1526:prod sqldev.dbuser:
    It seems to me that if I want to run SQL*PLus I should just highlight the connection name and it should use that information in whatever external tool I have configured.

  • Read integers from Strings

    Hi,
    I'm trying to make a program that scans a String for integers and then counts the integers,
    for example:
    the String s: lahd123kgfkg898 has two numbers, 123 and 898.
    Does anyone have an idea?

    It reminds me when I was a kid and asked my mother
    what a word meant. She'd tell me to look it up in the
    dictionary.omg, you just brought up my greatest pet peeve.
    i was raised to be curious and to find my answers in dictionaries,
    encyclopedias and book indices.
    id take a wild guess that 50% of americans dont know what an
    index is or when to use it. it is absolutely infuriating.
    sigh... not that it matters. in 10 years everything will be online.

  • Adding a JSON string to an outbound RESTful call in OSB 11.1.1.6

    Inside my Proxy Service Message Flow (OSB 11.1.1.6) I have generated a JSON string and stored it in a variable named $jsonReq.
    In my Routing action, I point to a Business Service whose Service Type is "Messaging Service" with both Request/Response Message Types as "Text".
    What is the proper way to assign the $jsonReq variable's contents to the outbound request body (I am doing a POST)?
    I have tried a number of configurations, but to no avail (though I see the JSON contents when I dump it out in a Log action), such as:
    Insert
    Expression: $jsonReq
    Location: as first child of
    XPath: .
    In Variable: outbound
    Please advise.
    Thank you,
    Michael

    Hello Prabu,
    Thank you for the suggestion. Assigning it to the body didn't work. I changed my configuration to this:
    Insert
    Expression: $jsonReq
    Location: as first child of
    XPath: .
    In Variable: outbound
    The net effect that I can see via the Test Console invocation tracing is that the change from:
    RouteToMyBusinessService -> Message Context Changes -> changed $body
    <soap:Body xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <!-- our original body from the proxy service inbound SOAP message -->
    </soap:Body>
    to
    RouteToMyBusinessService -> Message Context Changes -> changed $body
    <soap:Body xmlns:soap="http://www.w3.org/2003/05/soap-envelope"/>
    I know that the $jsonReq has data in it (per a log statement I made: <Jun 6, 2013 7:55:40 AM CDT> <Debug> <ALSB Logging> <BEA-000000> < [RouteToSCCreateBAMLabsProfileBusSvc, null, null, REQUEST] Inserted {"firstName":"string","lastName":"s","email":"stringstring","Login":"string","timeZone":"America/Montevideo","address":{"streetOne":"string","streetTwo":"string","city":"string","state":"st","zipCode":"string","country":"string"},"equipment":{"e":{"type":"Bed","code":"string","serial":"string","sku":"string","version":"string","dateOfPurchase":"2013-11-23T08:44:07"}}} into body> ).
    So why would the body be empty when I use the Insert action listed above?
    On a side note, is there only one 'body' variable in a proxy message flow? How do I distinguish between the body of the incoming request, the body of the [transformed] outgoing business service request, the body of the business service response and the body of the [transformed] proxy service response?
    Thanks again,
    Michael

  • Custom List Template - Adding a substitution string

    Hi all,
    I have created a List template by copying an existing list template.
    I want to have a substitution string so that I can assign a different identification to the list itself each time I use the list template.
    <ul id="#SOME_SUBSTITUTION_STRING#">
    <li></li>
    <li></li>
    </ul>The #A01# - #A10# seems to be applied only on list items. I cannot find a way to have such a substitution string that can be applied to the unordered list tag.
    Would anyone know of a way to do that? I'm using Apex 3.1
    Thanks,
    Raihaan

    The reason I want to be able to specify the id of the unordered list is that I have a javascript function using the id to build the rest of the list dynamically.
    But if that's not possible, I will have to hardcode the "id" in the template and have a different template everytime I want to implement a list having the same characteristics.
    Thanks,
    Raihaan

  • Adding image between string

    How to add a image between two string.
    example
    Test string one <IMG> testing string two

    An empty loop to wait for something is to avoid in all languages! At worst, put a sleep call in the loop. But a better idiom for JavaFX would be:
    function ChangeImage(image: Image): Void
        fadeOut.action = function()
            selectedImage = Image
                url: fileURL;
                height: 400, preserveRatio: true
                backgroundLoading: true
            var progress = bind selectedImage.progress on replace
                if (progress == 100)
                    fadeIn.playFromStart();
        fadeOut.playFromStart();
    }(untested)
    First, I create the Image when needed, to start the background loading. Or maybe the loading is very long and you prefer to start earlier, so your version is fine in this case.
    Second, I do what I described, binding to the progress variable of selectedImage, and watching the updates. And when we reach the wanted value, we start the second animation.

  • Find out Integers in String

    Hi all:
    I am stuck with a simple problem here. I have a file where there are 2 data types String(Item_Name) and int(Item_Code). Something like this: ----------------------------------------------------
      Item_Code            |          Item_Name  |
         34                                  Pens
           7                                   Ice Cream
    ---------------------------------------------------- Now, I can catch the error if users input character in Item_code like '34ab' with NumberFormatException but how to catch if they put digits in Item_Name like 'Pen345s' ?
    Should I first use string tokenizer to divide the strings and then check by individual characters? How to know if its a digit?
    thanks in advance.

    However if the question was what I had thought it was
    then I am right and you are wrong. Catching the
    exception IS the right thing to do.
    Because of overflow.Here's the code for Integer.parseInt() from the JDK 5.0 source. You can avoid the overhead of catching an exception if you code a simple isNumeric() function. As you can see, they iterate over each character in the string and check if it's a digit.
    By the way, most code I've written simple just catch the exception :)
    public static int parseInt(String s, int radix)
              throws NumberFormatException
            if (s == null) {
                throw new NumberFormatException("null");
         if (radix < Character.MIN_RADIX) {
             throw new NumberFormatException("radix " + radix +
                                 " less than Character.MIN_RADIX");
         if (radix > Character.MAX_RADIX) {
             throw new NumberFormatException("radix " + radix +
                                 " greater than Character.MAX_RADIX");
         int result = 0;
         boolean negative = false;
         int i = 0, max = s.length();
         int limit;
         int multmin;
         int digit;
         if (max > 0) {
             if (s.charAt(0) == '-') {
              negative = true;
              limit = Integer.MIN_VALUE;
              i++;
             } else {
              limit = -Integer.MAX_VALUE;
             multmin = limit / radix;
             if (i < max) {
              digit = Character.digit(s.charAt(i++),radix);
              if (digit < 0) {
                  throw NumberFormatException.forInputString(s);
              } else {
                  result = -digit;
             while (i < max) {
              // Accumulating negatively avoids surprises near MAX_VALUE
              digit = Character.digit(s.charAt(i++),radix);
              if (digit < 0) {
                  throw NumberFormatException.forInputString(s);
              if (result < multmin) {
                  throw NumberFormatException.forInputString(s);
              result *= radix;
              if (result < limit + digit) {
                  throw NumberFormatException.forInputString(s);
              result -= digit;
         } else {
             throw NumberFormatException.forInputString(s);
         if (negative) {
             if (i > 1) {
              return result;
             } else {     /* Only got "-" */
              throw NumberFormatException.forInputString(s);
         } else {
             return -result;
        }

Maybe you are looking for

  • Using cell phone as a 3G USB modem for Leopard

    Hi All, I just get an MacBook Pro the last week, I was happy with the UI of the OS at first sight, but when come to the setting of the network, I am really frustrated. I get a SE P1i cell phone, I would like to use it as a usb modem for my MAC so tha

  • Navigate In Place?

    When I navigate from one report to another report on a dashboard, is it possible to stay in the same window/section, i.e. the navigated report replace the report I'm on, instead of having a new window? I went to the dashboard Edit Page. I enabled 'Dr

  • Unplanned depreciation ABAA

    Hello Experts, I use ABAA to devaluate an asset(unplanned dep) with value date at 01.01.2010, but the depreciation run still not run for 01.2010. In AW01N, the column "Ord Dep" for all periods in 2010  still show the origianl depreciation value, but

  • Adding fileds to customer line items report  (RFITEMAR)

    Hi all,          I am modifying a customer line items report<b>(RFITEMAR).</b> I have to add two fields to a structure <b>(rfposxext).</b> I have completed this task. But the problem is how to populate these two fields. I am not able to find the sele

  • Error in JDI Configuration

    Hi All, i am getting an error in JDI configuration in the step importing MSS.sca file in CMS transport studio/development. error description as follows Fatal:the compartment sap.com_SAP_MSS_1 contains dirty DCs after the CBS build process: Info:dirty