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 [code] at the top of your block of code and the tag [/code] at the bottom, like so:
[code]
  // your code block goes here.
[/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

Similar Messages

  • How to find MATCH count for #  in a String

    Hi all,
    How to find MATCH count for #  in a String.
    Ex:  6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20
    Regards,
    Balavardhan.K

    >
    balavardhan k wrote:
    > I have used below syntax to find count but it is not returning the value and SY-SUBRC  = 4.
    >
    >
    > Data : l_text type string.
    >
    > l_text = '6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20'.
    >
    >
    > FIND ALL OCCURRENCES OF '#' IN L_TEXT MATCH COUNT mcnt .
    Then it's not a # but possible a horizontal tab-sign.
    Do a find on cl_abap_char_utilities=>horizontal_tab instead.
    Edited by: Maen Anachronos on Nov 23, 2010 2:48 PM

  • Counting letters in a word

    I am using lingo to count and display letters in a word but my script is stuck on a point. Can any help to solve this?
    property 
    SpriteNum
    global 
    gCurrentCounter, CurrentWord, lettersofCurrentWord, sSoundName
    On 
    MouseDown me
     if  gCurrentCounter < 10 then
    p = "00" & gCurrentCounter
    else if  gCurrentCounter < 100 then
    p = "0" & gCurrentCounter
    elsep = gCurrentCounterend ifj = 1
    letter_no = spritenum
    letter_name = member("PE_" & string(j)).text
    letter_uppercase = "A"
     -- puppetSound 1, "A sound"
    CurrentWord = member("word - " & p)i =
    1
    If  sprite (letter_no).within(sprite(spritenum)) Thenif 
    charToNum(member(CurrentWord).paragraph[1].char[1]) <= 90 then
    member ("pe_space_" & string(i)).text = letter_uppercase
    elsemember ("pe_space_" & string(i)).text = letter_name
    end if   
    end if set the  loc of sprite letter_no to point(300,330) 
    -- i = 2
    put  i 
    -- repeat while i <= CurrentWord.char.count
     if  charToNum(member(CurrentWord).paragraph[1].char[i]) >= 200 then
    member ("pe_space_" & string(i)).text = member(CurrentWord).paragraph[1].char[i]
    sprite  (letter_no).within(sprite (10 + i))
    elsemember ("pe_space_" & string(i)).text = letter_name 
    end if 
    i = i + 1
     -- end repeat
     end  mousedown me
      end

    **** Hello Sean see responses to questions in RED
    So what sort of sprite/member holds the completed word?
    Sean -  A complete set of sprite equal the number of letters in
    the word named pe_space_
    Presumably the code you posted is attached to individual letters of the
    alphabet?
    Sean - You assumed right
    I have re-posted your code with questions and comments interspersed -
    perhaps you could addess some of these:
    global gCurrentCounter, CurrentWord, lettersofCurrentWord, sSoundName
    property SpriteNum
    on mouseDown me
    if gCurrentCounter < 10 then
    p = "00" & gCurrentCounter
    else if gCurrentCounter < 100 then
    p = "0" & gCurrentCounter
    else
    p = gCurrentCounter
    end if
    j = 1
    letter_no = spritenum
    -- I don't understand: since you declared j = 1
    -- your local var 'letter_name' will always be member("PE_1").text
    letter_name = member("PE_" & string(j)).text
    -- again, you have hard-coded something with no apparent reason
    letter_uppercase = "A" ***  Sean - In case the first letter is uppercase
    -- puppetSound 1, "A sound"
    CurrentWord = member("word - " & p)
    i = 1
    if sprite (letter_no).within(sprite(spritenum)) then
    if charToNum(member(CurrentWord).paragraph[1].char[1]) <= 90 then
    member("pe_space_" & string(i)).text = letter_uppercase
    else
    member("pe_space_" & string(i)).text = letter_name
    end if
    end if
    sprite(letter_no).loc = point(300,330)
    -- i = 2
    -- i will always equal 1 because that's how you declared it above, and it
    isn't changed
    Yes Sean, this is the reason for my been stuck on the first sprite
    or letter of my word. I was hoping to achive repeat effect by clicking on the mouse
    or keydown to get word spelt.
    But on mouseDown me or keyDown does not work with my code
    put i - This tell me that I am stuck on i = 1
    -- can you explain what this block of code is doing?
    -- I have no idea what the various members
    -- member("pe_space_" & string(i))
    -- are or how they're used
    Sean the pe_space_  are the fields where my letter PE_ get attached to,
    so when I release my letters on grab and move they are within these
    sprites/fields
    So, Sean can still help?
    repeat while i <= CurrentWord.char.count
    if charToNum(member(CurrentWord).paragraph[1].char[i]) >= 200 then
    member("pe_space_" & string(i)).text =
    member(CurrentWord).paragraph[1].char[i]
    -- 'within' is an operator that returns TRUE/FALSE
    -- so it isn't clear what you're trying to do here
    sprite(letter_no).within(sprite (10 + i))
    else
    member("pe_space_" & string(i)).text = letter_name
    end if
    i = i + 1
    end repeat
    end mouseDown
    Message was edited by: efeelo

  • How can i get a query to count a number of strings?

    I want the query to count for me how many holidays there are to the USA in my table. But im not sure how to get it to retreive the result of a string or varchar2 datatype. This is what i have tried so far.
    select count(COUNTRYVIS) <<this column contains all the countries visited
    from "IT220_HOLIDAYDETAILS" <<this is the table where the column is
    where COUNTRYVIS = "USA" << this is the result i want it to count
    ORA-00904: "USA": invalid identifier <<this is the error message im getting, is there a way to count strings?
    Thanks in advance!

    This has nothing to do with APEX. Please post basic SQL questions on the +{forum:id=75}+ forum.
    In any OTN forum, alll code should be posted wrapped in <tt>\...\</tt> tags as described in the FAQ:
    select count(COUNTRYVIS) -- this column contains all the countries visited
    from "IT220_HOLIDAYDETAILS" -- this is the table where the column is
    where COUNTRYVIS = "USA" -- this is the result i want it to countYou appear to be struggling with the distinction between identifiers and text literals. Hint: One uses double quotes, the other single quotes.
    Note that quoted identifiers are generally not a good idea.

  • Counting Characters in a string

    HI all!
    I am new working with java and i have an application where I have to count specific characters in a string e.g. 'a','.','H','4' and so on! I found an entry in the forum with this script:
    String text = "Hello World!";
    int count = 0;
    for (int x = 0; x < text.length(); x++)
    if (text.charAt(x) == 'l')
    count++;
    This Script count all the 'I', but I could not get CharAt to count different characters at once!
    Is there a way?
    Thx for your help!
    LeBite

    String text = "Hello World!";
    int countl = 0;
    int counto = 0;
    for (int x = 0; x < text.length(); x++)
        if (text.charAt(x) == 'l') countl++;
        if (text.charAt(x) == 'o') counto++;
    [/code[                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Counting character in a string

    I'm trying to count how many times a characters occurs in a string, and I'm having a lot of trouble. This is what I have so far:
    note: the method call has to be public static int countOccs(char f, String s) and I know that it can be done using only loops, for, charAt, and length () and I want to learn it like that.
    [I just chose f, s randomly.]
    public class Counting {
    public static void main(String [ ] args) {
    String s = "Testing";
    int countOccs = s.length( );
    char [ ] charArray = new new char[counting];
    for (int i = 0; i < counting; i++) {
    charArray[i]
    public static int counting(char f, String s) {
    I'm really lost. When I try to define char f = "f" or String s = "Testing" in the method call (public static int counting...) I get messages saying that it has already been declared in the call, but there has been nothing assigned to it. Anyways, I feel really lost. I did find a pattern by looking at my notes from awhile ago, but am having trouble filling out parts of it. (Thanks, memory...) I think the problem comes from having to have the method call be public static int counting (char f, String s). That part confuses me a lot because I want it to print out how many characters of f are in a string, but it doesn't have "void" in it so it doesn't return a value.
    for (int i=0; i < s.length(); i++)
    char f = s.charAt(i);
    if (something that looks at the characters)
    do something like count
    Edited by: MAresJonson on Feb 6, 2009 6:50 PM

    h1. The Ubiquitous Newbie Tips
    * DON'T SHOUT!!!
    * Homework dumps will be flamed mercilessly. [Feelin' lucky, punk? Well, do ya'?|http://www.youtube.com/watch?v=1-0BVT4cqGY]
    * Have a quick scan through the [Forum FAQ's|http://wikis.sun.com/display/SunForums/Forums.sun.com+FAQ].
    h5. Ask a good question
    * Don't forget to actually ask a question. No, The subject line doesn't count.
    * Don't even talk to me until you've:
        (a) [googled it|http://www.google.com.au/] and
        (b) had a squizzy at the [Java Cheat Sheet|http://mindprod.com/jgloss/jcheat.html] and
        (c) looked it up in [Sun's Java Tutorials|http://java.sun.com/docs/books/tutorial/] and
        (d) read the relevant section of the [API Docs|http://java.sun.com/javase/6/docs/api/index-files/index-1.html] and maybe even
        (e) referred to the JLS for "advanced" questions.
    * [Good questions|http://www.catb.org/~esr/faqs/smart-questions.html#intro] get better Answers. It's a fact. Trust me on this one.
        - Lots of regulars on these forums simply don't read badly written questions. It's just too frustrating.
          - FFS spare us the SMS and L33t speak! Pull your pants up, and get a hair cut!
        - Often you discover your own mistake whilst forming a "Good question".
        - Often you discover you discover you where trying to answer "[the wrong question|http://blog.aisleten.com/2008/11/20/youre-asking-the-wrong-question/]".
        - Many of the regulars on these forums will bend over backwards to help with a "Good question",
          especially to a nuggetty problem, because they're interested in the answer.
    * Improve your chances of getting laid tonight by writing an SSCCE
        - For you normal people, That's a: Short Self-Contained Compilable (Correct) Example.
        - Short is sweet: No-one wants to wade through 5000 lines to find your syntax errors!
        - Often you discover your own mistake whilst writing an SSCCE.
        - Often you solve your own problem whilst preparing the SSCCE.
        - Solving your own problem yields a sense of accomplishment, which makes you smarter ;-)
    h5. Formatting Matters
    * Post your code between a pair of &#123;code} tags
        - That is: &#123;code} ... your code goes here ... &#123;code}
        - This makes your code easier to read by preserving whitespace and highlighting java syntax.
        - Copy&paste your source code directly from your editor. The forum editor basically sucks.
        - The forums tabwidth is 8, as per [the java coding conventions|http://java.sun.com/docs/codeconv/].
          - Indents will go jagged if your tabwidth!=8 and you've mixed tabs and spaces.
          - Indentation is essential to following program code.
          - Long lines (say > 132 chars) should be wrapped.
    * Post your error messages between a pair of &#123;code} tags:
        - That is: &#123;code} ... errors here ... &#123;code}
        - OR: &#91;pre]&#123;noformat} ... errors here ... &#123;noformat}&#91;/pre]
        - To make it easier for us to find, Mark the erroneous line(s) in your source-code. For example:
            System.out.println("Your momma!); // <<<< ERROR 1
        - Note that error messages are rendered basically useless if the code has been
          modified AT ALL since the error message was produced.
        - Here's [How to read a stacktrace|http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/].
    * The forum editor has a "Preview" pane. Use it.
        - If you're new around here you'll probably find the "Rich Text" view is easier to use.
        - WARNING: Swapping from "Plain Text" view to "Rich Text" scrambles the markup!
        - To see how a posted "special effect" is done, click reply then click the quote button.
    If you (the newbie) have covered these bases *you deserve, and can therefore expect, GOOD answers!*
    h1. The pledge!
    We the New To Java regulars do hereby pledge to refrain from flaming anybody, no matter how gumbyish the question, if the OP has demonstrably tried to cover these bases. The rest are fair game.

  • Counting SPACES in a string field.

    Hi ,
           can any one plz send me the code for counting the number of spaces in a particular string.
       like if we have the value as 100 00 0000.  we must get the out put as 2 .

    try this...
    DATA : str TYPE string VALUE '100 00 0000',
           str_len TYPE i,
           str_len2 TYPE i,
           space_count TYPE i.
    str_len = STRLEN( str ).
    CONDENSE str NO-GAPS.
    str_len2 = STRLEN( str ).
    space_count = ( str_len - str_len2 ).
    WRITE :/ space_count.

  • Read Text file and count occurences of certain string

    Hello,
    I have a text file with lines of data in it. I would like to read this text file and count how many lines match a certain string of text. 
    For example my text file has this data in it.
    dog,blue,big
    dog,red,small
    dog,blue,big
    cat,blue,big
    If the certain string of text is "dog,blue,big" then the count would return "2".
    Thanks for your help

    Hello,
    Thank you for your post.
    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses the usage issue of Visual Studio IDE such as
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
    In addition, if you are working with Windows Forms app. please consult on Windows Forms Forum:http://social.msdn.microsoft.com/Forums/windows/en-US/home?category=windowsforms
    If you are working with WPF app, please consult on WPF forum:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf
    If you are working with ASP.NET Web Application, I suggest that you can consult your issue on ASP.NET forum:
    http://forums.asp.net/
     for better solution and support.
    Visual Studio Language Forums:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • 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.

  • 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 specific characters in string

    // method  that counts and returns the number of times a specific character
    // appears in the data string
    public int numChar(char _charData)
         for(int i = 0; i < dataString.length(); i++)
               if(_charData == dataString.indexOf(_charData))
                    int count = 1;
                    int countIt = 0;
                    countIt = countIt + count;
                    return countIt;
    int nothing = 0;
    return nothing;
    }

    And your question is....?
    I have one: Where does dataString come from? You don't pass it in. Seems ridiculous to make it a class member.
    This is wrong:
    if(_charData == dataString.indexOf(_charData))Should be:
    if(_charData == dataString.charAt(i))The logic inside the if is incorrect, too. You don't want to return after the first time you find a character. You want to loop all the way through and count all the instances.
    You might have been trying to stop the loop once the indexOf returned -1, but you should be doing it on the remaining substring in that case.
    The style is poor. If I were reviewing your code, I'd say that your "nothing = 0" doesn't add any value.
    I'd write it like this:
    public class CharCounter
       public static void main(String [] args)
          if (args.length > 1)
             String str  = args[0];
             char ch     = args[1].charAt(0);
             System.out.println("str  : " + str);
             System.out.println("ch   : " + ch);
             System.out.println("count: " + getCharCount(ch, str));
       public static int getCharCount(char ch, String str)  
          int charCount = 0;
          if (str != null)
             int numChars = str.length();
             for (int i = 0; i < numChars; ++i)
                if (ch == str.charAt(i))
                   ++charCount;
          return charCount; 
    }%

  • Counting occurences of a string (in a cell)

    This is a little like the topic "Counting occurences of a word," except I want to be able to count how many times a specified search string occurs in a cell, not count how many cells contain the string. I would also like a formula that gave the offset of the starting character of the search string into the cell, such that a zero signified that the search string did not occur.
    Basically, I want a general set of tools to parse a cell's string data, enabling me to determine where in the cell's string data each occurrence of another string is located & to extract parts of the string data relative to where the search string occurs.
    For example, if the cell contains the string, "1ab2cd2e" I want to be able to extract "cd" & "e" based on the characteristic that they follow "2."

    Here it is:
    --(SCRIPT decoupeur.app]
    Save the script as a Script, an Application or an Application Bundle named decoupeur
    Put the file in the folder
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    To use it,
    Select the group of cells to convert
    Copy to the clipboard
    Select the destination cell
    Goto Scripts > Numbers > decoupeur
    You will be asked to define the separator to use.
    Given the separator "2", the strings of the kind "1zer6sd2az2rt8aa2er7kkk5uu2a"
    would be parsed and return az TAB rt TAB er TAB a
    The converted values will be pasted at the cursor.
    Yvan KOENIG 30juin 2008
    property theApp : "Numbers"
    property menuFenetre : 10
    property premierNom : 6
    property nomDuDocActif : ""
    property theDelim : ""
    property listeLignes : {}
    property listeTemp : {}
    property msg90 : ""
    property msg91 : ""
    property msg92 : ""
    --=============
    on run
    tell application "System Events" to if not (UI elements enabled) then set (UI elements enabled) to true (*
    Active le GUI scripting
    • Enable GUI scripting *)
    my nettoie()
    my controleVersion()
    set nomDuDocActif to my getFrontDoc()
    if nomDuDocActif = "" then return
    my prepareMessages()
    try
    set txtDatas to the clipboard as Unicode text
    on error (*
    The clipboard was empty *)
    return
    end try
    set my listeLignes to every paragraph of txtDatas
    set srcNbRows to count of my listeLignes
    if txtDatas contains tab then (*
    several columns *)
    error "Can't treat several columns" number 8001
    else (*
    single column *)
    tell application theApp
    set choix to choose from list {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"} with prompt msg90 default items {"2"} OK button name msg91 cancel button name msg92
    end tell
    if choix is false then error -128
    set theDelim to item 1 of choix
    repeat with i from 1 to srcNbRows
    if item i of my listeLignes is not "" then set item i of my listeLignes to my decipher(item i of my listeLignes)
    end repeat
    end if
    set the clipboard to my recolle(listeLignes, return)
    my pasteIt()
    my nettoie()
    end run
    --=============
    on pasteIt()
    tell application theApp to activate
    tell application "System Events" to tell (first process whose title is theApp)
    click menu item nomDuDocActif of menu 1 of menu bar item menuFenetre of menu bar 1
    keystroke "v" using {command down}
    end tell
    end pasteIt
    --=============
    on decoupeur(n)
    local d, ms, m
    set d to n div 1
    set ms to (n - d) * 60
    set m to round (ms)
    return (d as text) & "°" & m & "’" & (round ((ms - m) * 60)) & "”"
    end decoupeur
    --=============
    on decipher(source)
    local i, itm, shortimem, j
    set my listeTemp to my decoupe(source, theDelim)
    set my listeTemp to items 2 thru -1 of my listeTemp
    repeat with i from 1 to count of my listeTemp
    set itm to item i of my listeTemp
    set shortItem to ""
    repeat with j from 1 to length of itm
    if character j of itm is not in "1234567890" then
    set shortItem to shortItem & character j of itm
    else
    exit repeat
    end if
    end repeat
    set item i of my listeTemp to shortItem
    end repeat
    return my recolle(my listeTemp, tab)
    end decipher
    --=============
    on getMinutesSeconds(t, d)
    local ll
    set ll to my decoupe(t, d)
    return {(item 1 of ll) as integer, (item 2 of ll) as text}
    end getMinutesSeconds
    --=============
    on decoupe(t, d)
    local l
    set AppleScript's text item delimiters to d
    set l to text items of t
    set AppleScript's text item delimiters to ""
    return l
    end decoupe
    --=============
    on recolle(l, d)
    local t
    set AppleScript's text item delimiters to d
    set t to l as text
    set AppleScript's text item delimiters to ""
    return t
    end recolle
    --=============
    on nettoie()
    set AppleScript's text item delimiters to ""
    set my listeLignes to {}
    set my listeTemp to {}
    set nomDuDocActif to ""
    end nettoie
    --=============
    Get the name of the active document
    on getFrontDoc()
    local nw, mm
    tell application theApp to activate
    tell application "System Events" to tell (first process whose title is theApp)
    set nw to name of every menu item of menu 1 of menu bar item menuFenetre of menu bar 1
    if (count of nw) < premierNom then
    set mm to ""
    else
    repeat with i from premierNom to count of nw
    set mm to item i of nw
    if (value of attribute "AXMenuItemMarkChar" of menu item mm of menu 1 of menu bar item menuFenetre of menu bar 1) is not in {"", "•"} then exit repeat
    end repeat
    end if -- (count of nw)…
    end tell
    return mm
    end getFrontDoc
    --=============
    on controleVersion()
    local v
    try
    set v to version of application theApp
    set menuFenetre to 10 (* index of the Windows menu *)
    set premierNom to 6 (* index of the first docName in the list of menu names
    The list contains one more item than the displayed menu *)
    on error (*
    • We are here if Numbers ignores the instruction get version *)
    tell application "System Events" to set v to get version of (get (application file of (get first process whose title is theApp)))
    if v starts with "1" then
    set menuFenetre to 10
    set premierNom to 6
    else (* ready for a Numbers v2 ignoring AppleScript *)
    set menuFenetre to 10
    set premierNom to 6
    end if
    end try
    end controleVersion
    --=============
    on parleAnglais()
    local z
    try
    tell application theApp to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z = "Cancel")
    end parleAnglais
    --=============
    on prepareMessages()
    if my parleAnglais() is false then
    set msg90 to "Choisir le séparateur"
    set msg91 to " OK "
    set msg92 to "Annuler"
    else
    set msg90 to "Choose a separator"
    set msg91 to " OK "
    set msg92 to "Cancel"
    end if
    end prepareMessages
    --=============
    --[/SCRIPT]
    Yvan KOENIG (from FRANCE lundi 30 juin 2008 11:16:52)

  • Counting letters

    Good Afternoon all,
    Very new to Labview 2011 and taking it as a class in college and need some help.  I have tried many different ways but none are working so I will post the question and if anyone can help me with picture view I would very much appreciate it.
    Question:
    Provide a string control called Name.  Provide a string indicator called Greeting.  Provide a numerical control (U16 representation) called Last Name Length.  The VI should examine the data entered in Name, find the firt name only and produce a Greeting that says "Hello Joe!"  The VI should also find the last name, and determine the number of letters in it., and write this value to Last Name Length.  Provide an appropriate connector pane, and connect up all three front panel items so that the VI can be used as a subVI. 
    Please help!!!
    The picture is how it is supposed to look.
    Attachments:
    labview.PNG ‏64 KB

    newstudent wrote:
    I have tried many different ways but none are working so I will post the question and if anyone can help me with picture view I would very much appreciate it. 
    Please show us all your failed attempts and explain in what way they did not work (unresponsive, wrong result, no result, clipped result, computer crashes, computer blows up). Maybe you can see a pattern yourself after doing some tutorials or by looking at the lecture notes you took during the course.
    There are no programming environments called "picture view" or anything similar (PictureVIEW, etc.).
    Since you posted in a LabVIEW forum and judging from your picture, I assume you mean LabVIEW. Can you confirm that?
    LabVIEW Champion . Do more with less code and in less time .

  • 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);
           }

  • Word counting program - new to strings

    Im trying to write a program that will tell me how many times the word "rabbit" appears in a text file. This is what I ahve so far and I am not sure if it is correct. I get a cannot find symbol
    symbol : method indexOf(java.lang.String) error when I compile.
    import java.util.Scanner;       
    import java.io.File;            
    import java.lang.String;
    public class Rabbitcount
      public static void main( String[] args ) throws Exception  // new: throws Exception, copy and paste for now
        File f = new File("rabbit.txt");
        Scanner input = new Scanner(f);
      while (true) {
      int x = indexOf("rabbit");
        System.out.println("There are " + x + " occurences of rabbit in the text.");
    // Close the file
        input.close();  
    } Any help is appreciated
    Edited by: euchresucks on Nov 3, 2008 2:23 PM

    indexOf() is a String method. If you were going to use that, you would have to load the file's contents into a String and call indexOf() on that String. You would also need to use the two-argument form of indexOf() so you could start each search at the point where the last match ended.
    But you don't need to do any of that. You've already a perfectly good Scanner there; use it to do the searching. Hint: the name of method you need does not start with the word "next".

Maybe you are looking for

  • BPM - Message has error on the outbound side

    I get this error 'Message has error on the outbound side" . I am using IDOC - BPM - JDBC. I checked SXI_CACHE and I see ret code 99 for this Integration Process. I tried to activate it. I see an error saying that ZCUST_NUMBER is not a component objec

  • Just Upgraded to Snow Leopard and ruined Logic - Help!

    I'm running Logic 8, NI Komplete and Reason 4.0. All was dandy under 10.5.8. Upgraded to snow leopard last night and all apps were fine....except logic. I opened logic and it went to rescan all the AU. Fine, let it go a few mins but seemed to be hang

  • Action box for notification

    Hi, Can someone please explain to me the action box for notification in details and its corresponding spro settings. I am new into it.

  • Why is my hard drive clicking when idle?

    It seems this only happens in Lightroom. There is a constant click, like a hard drive head seek, once a second. I don't have Lightroom doing anything in the background like building thumbnails, but instead is just sitting idle there for hours. When I

  • I get a message that I ned to check proxy settings. What does this mean?

    The proxy server is refusing connections Firefox is configured to use a proxy server that is refusing connections. Check the proxy settings to make sure that they are correct. Contact your network administrator to make sure the proxy server is workin