Currently i'm learning to use C# at school.
Last lesson I had learned about strings, and got some homework to get
done.
So here it is :
1) Make a function that will get two strings, check if they are the
same, and then return false\true. (The teacher said "DO NOT USE
STRING.COMPARE"). I tried do this one using FOR, but I always get out
of the index bounds. (here is my function) :
        static bool GetNCheck(string s, string p)
        {
            int o = s.Length-1;
            int i = 0;
            if (s[s.Length - 1] < p[p.Length - 1])
                o = p.Length - 1;
            for (; s[i] == p[i] && i < o; i++) ;
            if (i == s.Length-1 && i == p.Length-1)
                return true;
            return false;
        }

2)MAke a function that get a string, check if it have any numbers in
it, and then return false\true.

thanks :D

Reply via email to