Search:

Type: Posts; User: av8

Search: Search took 0.19 seconds.

  1. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,670

    Re: Iterating a String

    Thank you Norm for your patience

    for(int count = 0; count < aString.length(); count++)
    {
    DisplayLetter(aString.charAt(count));
    }
    I had missed out the curlys, program works now. thanks...
  2. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,670

    Re: Iterating a String

    Another scenario

    String String1 = new String();

    String1 = "bubble";

    String1.charAt(0);
    String1.charAt(1);
    String1.charAt(2);
    String1.charAt(3);
  3. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,670

    Re: Iterating a String

    Sorry,

    String aString = new String();



    aString = "bubble";

    for(int count = 0; count < aString.length(); count++)
    DisplayLetter(aString.charAt(count));
  4. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,670

    Re: Iterating a String

    for(int count = 0; count < aString.length(); count++)
    DisplayLetter(aString.charAt(count));
  5. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,670

    Re: Iterating a String

    Thanks Norm I've tried this and it displays only the last letter e.
  6. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,670

    Re: Iterating a String

    Can you advise on the syntax how to put the loop index into the method call.

    Thank you.
  7. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,670

    Re: Iterating a String

    I'm getting there slowly. I can have the loop counter as an actual parameter to itererate through a string object

    DisplayLetter(String1.charAt(for (int count= 0; count < aString.length; count++));...
  8. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,670

    Iterating a String

    String String1 = new String();

    String1 = "bubble";


    My method : DisplayLetter(char aChar);



    If I execute
Results 1 to 8 of 8