convert_lower_upper.htm | |
Objectives :
|
|
using System; //csc /target:library convert_upper.cs // Unfortunately, the String class in the //.NET Framework is sealed; therefore, //you can’t derive from it. namespace C_Cap { public class ucap { public static string Ucase(string str) { str = str.ToLower(); string strempty = ""; char[] chEmpty = new char[]{' '}; foreach (string search in str.Split(chEmpty)) { strempty += char.ToUpper(search[0]); strempty += (search.Substring(1, search.Length - 1) + ' '); } return strempty; } } //end of the name space } |
using C_Cap; using System; //csc reference:convert_upper.dll //try_case.cs class test { static void Main() { Console.Write("Write a sentence :"); string str = Console.ReadLine(); string con_str = ucap.Ucase(str); Console.WriteLine("Line Entered :" + str); Console.WriteLine("Line Changed :" + con_str); } } |
Back to void or return |