[Mono-list] ToUpper and ToLower methods

Iñigo Illán iillan@terra.es
14 Jan 2003 23:36:25 +0100


--=-cRgvizV8L9ihkWrcqkmv
Content-Type: multipart/alternative; boundary="=-bbxxPza82dVyL9vIaP6t"


--=-bbxxPza82dVyL9vIaP6t
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello everyone!

I've learning C# and I've seen that the ToUpper and ToLower methods were
not impleted so I've write 2 simple programas that do this.

What do you think about them?


P.D.: Magic is real......... unless declared integer. 
P.D.D.: Para entender lo que es la recursividad, primero hay que
entender lo que es la recursividad.

--=-bbxxPza82dVyL9vIaP6t
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/1.0.2">
</HEAD>
<BODY>
Hello everyone!
<BR>

<BR>
I've learning C# and I've seen that the ToUpper and ToLower methods were not impleted so I've write 2 simple programas that do this.
<BR>

<BR>
What do you think about them?
<BR>

<BR>

<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
P.D.: Magic is real......... unless declared integer. 
<BR>
P.D.D.: Para entender lo que es la recursividad, primero hay que entender lo que es la recursividad.
</TD>
</TR>
</TABLE>

</BODY>
</HTML>

--=-bbxxPza82dVyL9vIaP6t--

--=-cRgvizV8L9ihkWrcqkmv
Content-Disposition: attachment; filename=tolower.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=tolower.cs; charset=ANSI_X3.4-1968

using System;

class tolower
{
        public static char func_tolower(char c)
        {
                int aux;

                aux =3D ((int)c);
                if (aux <=3D 90 && aux >=3D 65)
		{
                        aux =3D aux + 32;
                        c =3D ((char)aux);
                        return c;
		}
		else if (aux =3D=3D 165)
		{
			aux--;
			c =3D ((char)aux);
			return c;
		}
		return c;
	}

        public static void Main()
        {
		Console.Write ("Enter a character: ");

		string character =3D Console.ReadLine();

                Console.WriteLine("{0}", func_tolower(character[0]));
        }
}

--=-cRgvizV8L9ihkWrcqkmv
Content-Disposition: attachment; filename=toupper.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=toupper.cs; charset=ANSI_X3.4-1968

using System;

class toupper
{
	public static char func_toupper(char c)
	{
		int aux;

		aux =3D ((int)c);
		if (aux <=3D 122 && aux >=3D 97)
		{
			aux =3D aux - 32;
			c =3D ((char)aux);
			return c;
		}
		else if (aux =3D=3D 164)
		{
			aux++;
			c =3D ((char)aux);
			return c;
		}

		return c;
	}

	public static void Main()
	{
                Console.Write ("Enter a character: ");

                string character =3D Console.ReadLine();

                Console.WriteLine("{0}", func_toupper(character[0]));
	}
}

--=-cRgvizV8L9ihkWrcqkmv--