Adding letters to a string

Hi,
Is it possible to add on one letter at a time to a string, to create a word, like when you go through a loop.
Loop 1: add a - String = a
Loop 2: add b - String = ab
Loop 3: add c - String = abc
Thanks

       String getit = "";
      for(int x = 0;x<6; x++) {
      getit += (x == 1) ? "h" : "" ;
      getit += (x ==2) ? "e" :"" ;
      getit += (x == 3) ? "l" :"" ;
      getit += (x == 4) ? "l" :"" ;
      getit += (x == 5) ? "o" :"" ;
       System.out.println(getit);or
     String getit = "";
      for(int x = 0;x<6; x++) {
      getit += (x == 1) ? "h" : "" ;
      getit += (x ==2) ? "e" :"" ;
      getit += (x == 3) ? "l" :"" ;
      getit += (x == 4) ? "l" :"" ;
      getit += (x == 5) ? "o" :"" ;
       System.out.println(getit);
       }

Similar Messages

  • [svn:fx-trunk] 11717: Bug Fixing Localized SDK - modified one file xercesSchema. properties in xercesImpl_ja.jar - added " to one JA string.

    Revision: 11717
    Author:   [email protected]
    Date:     2009-11-12 11:54:22 -0800 (Thu, 12 Nov 2009)
    Log Message:
    Bug Fixing Localized SDK - modified one file xercesSchema.properties in xercesImpl_ja.jar - added " to one JA string.
    ANT CLEAN MAIN successful
    Modified Paths:
        flex/sdk/trunk/lib/xercesImpl_ja.jar

  • My Ipad2 has started adding letters between words when I type.  The letters are usually, but not always, m.  I use Safari browser.  Can't figure this one out!

    Adding to the question I posted, my iPad will string words together by inserting letters (usually m, but sometimes n) between.  Even when I back up and delete the extra letter, it will pop up again until the second delete.  So it's in autocorrect?  Have I taught my device to do this by being a sloppy typist?

    Try asking in the iPad forum. This forum is for iPhones being used in an Enterprise (corporate) environment.

  • Replacing the letters in a string

    I have an odd set of fields for properties for my client.
    Some have multiple
    letters which correspond to a code table. How can I loop
    through the string
    and replace the letters with words
    For example
    A = central air
    B = ceiling fan
    C = A/C Unit
    If the field looks like 'ABC', it would be outputted to the
    page as 'central
    air ceiling fan A/C Unit'
    Wally Kolcz
    MyNextPet.org
    Founder / Developer
    586.871.4126

    You don't say how many unique letters you have, but I presume
    it is 26 or less. If that's the case, you could index an array that
    has been initialized with the words. See concept code below. It
    assumes only upper case letters.

  • Adding " char to SQL string

    I'm using Netbeans IDE 3.4 and trying to build SQL statments for MySQL DB.
    For that reason I need to concate the char " or ' to my SQL string . for example I need to create the string:
    SELECT * FROM user WHERE username = "test".
    I use variables to get the username from other function and I need to create that statment, I tried to run the following code:
    SELECT * FROM user WHERE username =" + '\"' + Username + '\"'
    and also tried to run:
    SELECT * FROM user WHERE username =" + "\"" + Username + "\""
    but I get always the following string:
    SELECT * FROM user WHERE username =\"test\" , which of course is not OK.
    I tried to replace the " with ' but with no luck.
    Can someone help ?
    Many Thanks...

    String sql = "SELECT * FROM user WHERE username = '" + username + "'"
    single/double double/single/double
    You will have problems where your username is something like 'O'Neil' where you will have to escape the single quote within the username by adding an additional single quote 'O''Neil'
    single/single

  • Extract specific letters from a string of text

    Hello,
    I have an idea that I would like to implement into Numbers but I'm not quite sure how to do it, or even if it is possible. What I would like to do is replace a multitude of checkboxes with one cell. In that one cell I will have a string of text, with a letter representing a condition. From this one cell, I would like to be able to extract a certain letter into its own cell and then hide the multitude of cells.
    My idea is to eventually just be able to type the conditions into a single cell, extract the letter of the certain condition into another cell, and then extract that information into another table, all the while hiding all of the auxiliary columns in the original table. Because it would be much easier and prettier to simply type a bunch of letters into one box instead of having to check a bunch of boxes, no?
    For example Left Header Row 1 would contain the letters BMRT. Column A would return a "FALSE" value, while Column B would return "B" or "TRUE." Columns C through L return "FALSE," etc.
    In Left Header Row 2 we would have the string AJQTVZ, for instance. Column A would return "A" (or "TRUE"), and Columns B through I would return "FALSE."
    Is it possible to write such a formula? Or is there an easier way to be thinking about this problem?

    Let's start with the easy part.
    Cells on a Numbers table can contain data entered directly, or can contain a formula. They can't contain both. That means you cannot 'type the conditions into a single cell' in column A ("the left header" cell) AND have a formula which sets that cell to TRUE if the typed in data contains an "A".
    There's no problem doing this using column A as the key holder and columns B:Z to hold the TRUE/FALSE results, staring in both cases on row 2.
    Here's an example
    The column header cells (row 1) contain the letter corresponding to that column.
    The row header cells (starting at row 2) contain the 'bunch of letters' you describe. Note (A4) that the letters do not have to be entered in any particular order, and that extraneous characters (eg. a space) are ignored.
    The formula shown is entered B2, and filled down and right from there.
    =IFERROR(FIND(B$1,$A2)>0,FALSE)
    FIND returns the position of the first occurrence of the target string (in this case, the single letter at the top of the column) in the search string, then compares that with the value zero. For any letter that is included in the search string, the find value will be at least 1, so the comparison will return TRUE. If the target letter is not found, FIND returns an error. IFERROR traps this and returns FALSE.
    Since the target depends on the letter at the top of the column, all that's needed to extend the range of possible letters to the full alphabet is to enter an A in cell B1, then run through the alphabet A to Z, with Z in cell AA1.
    Depending what you want to do with the TRUE or FALSE values in these 26 columns, it may be possible to skip the auxiliary column step and use a formula similar to the one above as the condition argument of an IF(condition,do-if-true,do-if-false) statement.
    Regards,
    Barry

  • Counting letters in a string

    Hi,
    I am new to Java. What's the most efficient way to count the number of characters in a string. I have a string of text called MyText. I was thinking of a for loop but maybe there is better solution?
    Regards,
    Rob.

    FYI:
        public static void main(String[] args)
            String word;
            System.out.println("Enter word");
            word = EasyScanner.nextString();
            word.length(); // this is redundant and serves no purpose
            System.out.println(word.length());
        }Also, when posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag &#91;code] at the top of your block of code and the tag &#91;/code] at the bottom, like so:
    &#91;code]
      // your code block goes here.
    &#91;/code]Your posted code will need to be properly formatted to begin with for this to work.
    Good luck.
    Edited by: Encephalopathic on Jan 6, 2008 10:45 AM

  • Adding white spaces between strings during concatenation in JSTL

    Please provide a way to add white space between strings during concatenation in JSTL.
    I tried the following.
    eg:
    <c:set var="even_odd" value="odd">
    <c:out value="first ${even_odd}"/>
    I want the output string as "first odd ".
    Moreover i am using the above value for generating the class attribute of a row of a table like
    <tr class=<c:out value="first ${even_odd}"/>>
    while printing the value of <c:out value="first ${even_odd}"/> in the page,i am getting correctly as i needed as "first odd".
    But while taking the code of the page while rendering by the browser, it is showing like
    <tr class="first" odd="">
    I think the white space is the problem.
    Please provide any solution or hint.

    <tr class=<c:out value="first ${even_odd}"/>><tr class="first ${even_odd}">

  • Adding Characters to a string in a loop

    Hi
    I have a task where if the text perameter is more than 10 characters in cuts it down to 10, which i can do. If it is 10 it just gives it back, which i can do. But if it is less than 10 you need to add extra spaces onto the end of it. I cant seem to think how to do it. What i have at the moment seems to put it in an infinite loop. Any tips or hints would be much apreciated.
    public class Main
         public static String trimTo10(String s)
    int i, len = s.length();
    String results = "";
    if (len >10)
    for (i =0; i <= 9; i++) {
    char w=s.charAt(i);
    results = results + w ;
    if (len ==10){
    results = s ;
    if (len <10)
    for (i =0; len<=9; i++) {
    results =  s + " ";
    return results;     }
    }

    Hi
    You need to decide on exactly what you want to do. Write an algorithm of the process. (it doesn't have to be formal)
    Something like:
    <length is less than 10>
    get length of string
    number of spaces = 10 - length of string
    That should be enough to get you started...
    regards,
    lutha

  • Adding characters to a string

    hi guys,
    i have to do this:
    i take the string and read it character by character and everytime i read a new character, i put it into my output string until i reach the \n character, there i simply return my output string.
    THE problem: i need to be able to read it characters from my input string.
    I can't use a stringbuffer because that brings up other complications later inmy program.
    I basically need to know can i read something character by character and put it into a string
    thanx!
    public String Split(String input, int i)
    char carriagereturn= '\n';
    String output="";
    try
    while(i<input.length())
    if(input.charAt(i)== carriagereturn )
    return output;
    if(input.charAt(i)!= carriagereturn)
    output.concat(input.charAt(i));
    i++;
    } catch (Exception e)
    return output;
    }//end of method Split

    import java.io.*;
    public String split(String s) {
    ByteArrayInputStream bstream = new ByteArrayInputStream(s.getBytes());
    StringBuffer buf = new StringBuffer();
    int c;
    int CR = 13;
    int LF = 10;
    while ((c = bstream.read()) != -1) {
    if (c == CR || c == LF)
    break;
    buf.append((char)c);
    return buf.toString();

  • Adding text to a string

    Hi
    I am new to Numbers (I am using 09 on OS X 10.6.8)  - I need to add a couple of characters to the end of a text string in one cell, if the condition in another cell is true.
    A1 contains a persons name  A2 can contain the formula I am seeking A3 will contain a date (or not)
    So what I would like is,for a formula to detect if A3 contains a date - then if it does, to add the specified text (lets say a 'space' and '§') to the END of the persons name in A1.
    This is a work around for the often asked conditional format rule to change text colour if . . .
    Hope you can help
    C

    Hi Colin
    Formulas can change only the content of the cell containing the formula. A cell may contain an entered value or a formula, but not both, so unless the names in A2 have been generated by a formula in that cell, you cannot use a formula to append additional text to them.
    But you've said this is "a work around for the often asked conditional format rule to change text colour if . . ."
    Conditional format rules compare the value in a cell to a fixed value or to the value in another cell. Rather than changing the value in to cell to be formatted, you could change the value in another cell to match the value in the target cell under specific conditions, then use a comparison of that cells value to the value of the target cell's own value to trigger the conditional format.
    Here's a sample.
    The rule shown is for A4. The other two cells with names in column A use the same rule, but with the column C comparison cell in their own row. Column C, shown with yellow fill, may be hidden.
    C2 contains the formula below, which is Filled down to the other cells in column C:
    C2: =IF(LEN(B2)>0,A2,"")
    Note that this formula will detect any type of data entered into B2, not just a date.
    Regards,
    Barry

  • Adding "\b" to a string. Please help!

    I can't get to add "\b" (backspace) to a string.
    When I try to print the string, "\b" shows up as a square.
    It's a java applet, and import is "import java.applet.*;"
    Please help fast, I appreciate greatly!

    I can't get to add "\b" (backspace) to a string.Why would you want to? Why not just delete the last character?
    When I try to print the string, "\b" shows up as a square.Print it on what? Clearly on something that doesn't understand backspace.
    It all seems pointless to me.
    It's a java applet, and import is "import java.applet.*;"Entirely irrelevant except that it tells us this is a GUI, and GUIs don't understand backspaces, and you don't 'print' to a GUI, you display, and why you aren't just deleting the final character remains a mystery.
    Please help fastThe speed of the responses here depends on other people's time allocations, not yours.

  • Simple coding question: Adding variable to a string

    I can't figure out what the syntax is for this in Actionscript. Basically, I have a variable I want to add into a string that will call a certain frame based on user's language selection. So...
    var currentPage:int; <<this updates dynamically when nextPage, previousPage, etc are called
    if (currentLanguage == "English") {
         myMovie.gotoAndStop ("English%n", currentPage);
    else if (currentLanguage == "Spanish") {
         myMovie.gotoAndStop ("Spanish%n", currentPage);
    Then each frame of myMovie will be named "English1" "Spanish1" "English2" "Spanish2" etc to correlate with page numbers.
    Is this possible in Actionscript 3.0?
    Thanks!

    sure.  you can use a variable in place of the frame label and/or the scene name.  from your code, you're using a variable in place of the scene name.  that should work (if you're using scenes).
    if you want to go to frame label english1, when currentPage is 1, you should use:
    myMovie.gotoAndStop("english"+currentPage,possiblescenenamehere);
    and because i don't think you're using scenes, just use:
    myMovie.gotoAndStop("english"+currentPage);
    or, even easier:
    var currentPage:int;  // defined somewhere;
    var language:String;  // defined somewhere;
    myMovie.gotoAndStop(language+currentPage);

  • Adding new method into String.java (just for personal usage)

    For some reason, it kept bringing in the old String.class, even I updated it the rt.jar with the new String.class. I even checked it with jar -tvf rt.jar. It has the new String.class. However, it seemed to constantly loading in the old one. Unless I use bootclasspath. The followng is the test :
    1.     I add a new function to String.java
    a.     : goody() { return “this is a test method”; }
    2.     To compile:
    a.     javac -bootclasspath ".\;C:\Program Files\Java\jdk1.6.0_03\jre\lib\rt.jar" String.java
    jar uf rt.jar java/lang/String.class
    3.     To test with file test.java where it calls String.goody()
    a.     To make sure it is not pulling in old code, I had to copy the new rt.jar to my test directory:
    i.     copy "C:\Program Files\Java\jdk1.6.0_03\jre\lib\rt.jar” .\
    4.     compile my test.java:
    a.     javac -bootclasspath .\rt.jar test.java
    5.     Execute the jvm:
    a.     java -Xbootclasspath:.\rt.jar;.\; test
    6.     I got output : “this is test method”
    =========================
    if I use the regular : java classpath where the new classpath does indeed reside in, it claims the symbol not found. I have to copy the rt.jar to my local and use -Xbootclasspath. Suggestion? Or, this is really the only way to be able to call a new method installed in String.class?

    eproflab wrote:
    a.     To make sure it is not pulling in old code, I had to copy the new rt.jar to my test directory:
    i.     copy "C:\Program Files\Java\jdk1.6.0_03\jre\lib\rt.jar&#148; .\That will not work.
    You must replace it in the VM directory or use the bootpath options. There is no other way.
    Note that you mess up with what you are doing (replacing the rt.jar way) that not only will you not be able to run, not even to get an exception, but you will not be able to compile either.

  • Keypad adding letters

    My Curve 9300 (only a few months old) has developed a problem overnight with the keypad.  It is adding o's and u's to other vowels, and I can't lock it with the 'a' key because it adds a 'u' etc etc.  Any help urgently appreciated!  Have taken battery out and rebooted, problem still there.

    Remove your battery and reset your device,
    if not then try this:
    http://btsc.webapps.blackberry.com/btsc/search.do?cmd=displayKC&docType=kc&externalId=KB18998

Maybe you are looking for

  • Sound drops off when using hdmi outport to connect computer to an AV reciever

    Satellite M640,I5 2410 processor, windows 7HP. After about three minutes the sound drops off when connected to the av reciever through the hdmi outport. If I touch the trackpad the computer reconnects for another three minutes and  then disconnects.

  • Integration Directory - Transport using CMS does not appear

    Hi guys, I'm having problems with one thing I thought it would be trivial.... I'm not able to get the option 'Transport using CMS' in the Integration Directory available. I've done the necessary steps on the exchangeProfile in order to transport obje

  • SC - Approval Task Descrption

    Hi SRM Experts, In SRM7.0 SC workflow, I have an approval task description question. In process level configuration, I assigned the standard task id 40007953 which is SRM SC cart approval. The standard task description shows                "You are r

  • SWF file doesn't open with Flash Player

    Hi, 1) I have a swf file on my desktop. Where in my computer should i go to launch Flash Player in order to play the swf file? When I double click on th swf file, it launched Adobe Flash, rather than Flash Player. 2) Furthermore, I have just uninstal

  • Help with network on an offshore dive boat

    I have a question about the network set up on our boat. We have a satelite communication system. It was working fine. It has a modem with a 4 port hub on it. Off the hub goes a hardline to  the wheel hou8se computer, the dive shack computer, the surv