Search Results

Search found 2 results on 1 pages for 'annayena'.

Page 1/1 | 1 

  • Help with string equality in Java

    - by annayena
    The following function accepts 2 strings, the 2nd (not 1st) possibly containing *'s (asterisks). An * is a replacement for a string (empty, 1 char or more), it can appear appear (only in s2) once, twice, more or not at all, it cannot be adjacent to another * (ab**c), no need to check that. public static boolean samePattern(String s1, String s2) It returns true if strings are of the same pattern. It must be recursive, not use any loops, static or global variables. Also it's prohibited to use the method equals in the String class. Can use local variables and method overloading. Can use only these methods: charAt(i), substring(i), substring(i, j), length(). Examples: 1: TheExamIsEasy; 2: "The*xamIs*y" ---> true 1: TheExamIsEasy; 2: "Th*mIsEasy*" ---> true 1: TheExamIsEasy; 2: "*" ---> true 1: TheExamIsEasy; 2: "TheExamIsEasy" ---> true 1: TheExamIsEasy; 2: "The*IsHard" ---> FALSE I am stucked on this question for many hours now! I need the solution in Java please kindly help me.

    Read the article

  • HELP IN JAVA!! URGENT

    - by annayena
    The following function accepts 2 strings, the 2nd (not 1st) possibly containing *'s (asterisks). An * is a replacement for a string (empty, 1 char or more), it can appear appear (only in s2) once, twice, more or not at all, it cannot be adjacent to another * (ab**c), no need to check that. public static boolean samePattern(String s1, String s2) It returns true if strings are of the same pattern. It must be recursive, not use any loops, static & global variables. Also it's PROHIBITED to use the method equals in the String class. Can use local variables & method overloading. Can use only these methods: charAt(i), substring(i), substring(i, j), length(). Examples: 1: TheExamIsEasy; 2: "The*xamIs*y" --- true 1: TheExamIsEasy; 2: "Th*mIsEasy*" --- true 1: TheExamIsEasy; 2: "*" --- true 1: TheExamIsEasy; 2: "TheExamIsEasy" --- true 1: TheExamIsEasy; 2: "The*IsHard" --- FALSE I am stucked on this question for many hours now! I need the solution in Java please kindly help me.

    Read the article

1