Search:

Type: Posts; User: espltdf100

Search: Search took 0.09 seconds.

  1. Replies
    13
    Views
    2,206

    [SOLVED] Re: Could someone help me with this code?

    public int stringMatch(String a, String b)
    {
    int match = 0;
    int x = 0;
    int y = 2;
    String aa = a.substring(x,y);
    String bb = b.substring(x,y);
    ...
  2. Replies
    13
    Views
    2,206

    [SOLVED] Re: Could someone help me with this code?

    The new code is:


    public int stringMatch(String a, String b)
    {
    int match = 0;
    int x = 0;
    int y = 2;
    String aa = a.substring(x,y);
    String bb =...
  3. Replies
    13
    Views
    2,206

    [SOLVED] Re: Could someone help me with this code?

    It no longer returns all 0s, but I still don't recieve the expected answer.
    The tests are:

    stringMatch("xxcaazz", "xxbaaz") → expected 3, got 4
    stringMatch("abc", "abc") → expected 2, got...
  4. Replies
    13
    Views
    2,206

    [SOLVED] Re: Could someone help me with this code?

    My bad.

    The new code after using the equals method is:


    public int stringMatch(String a, String b)
    {
    int match = 0;
    int x = 0;
    int y = 2;
  5. Replies
    13
    Views
    2,206

    [SOLVED] Could someone help me with this code?

    Though my code compiles, it returns all 0's, and I don't understand why.

    The problem I have to answer is :

    Given 2 strings, a and b, return the number of the positions where they contain the...
Results 1 to 5 of 5