4
Reply

Write logic to convert any string to LOWER CASE without using string.ToLower()

Pavan R Bhupalam

Pavan R Bhupalam

11y
3.1k
1
Reply

    string ucase="ram"; string temp=null; foreach(char c in ucase) { int i=(int)c; if(c>=65 and c<91) { temp+=temp+((char)i+32); } } ucase=temp }

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class ConvertUppertoLowerCase { static void Main() { ConvertUppertoLowerCase p = new ConvertUppertoLowerCase(); Console.WriteLine("Enter any String"); string Str = Console.ReadLine(); p.ToLowerCase(Str); } public void ToLowerCase(string Str) { string temp=""; foreach(char c in Str ) { int i = (int)c; if(i>=65 && i<=90) { i= i+32; } temp += (char)i; } Console.WriteLine(temp); Console.ReadKey(); } } }

    public string ToLowerCase(string ucase) {string temp;foreach(char c in ucase){int i=(int)c;if(c>=65 and c<91){temp+=temp+((char)i+32);}} return temp; }


    public void lower()
            {
                Console.Write("entr d Word : ");
                string low = Console.ReadLine();
                string up = "";
                foreach(char l in low)
                {
                    int x = (int)l;
                    x = x + 32;
                    char c = (char)x;
                    up = up + c;
                }
                Console.WriteLine(up);
            }