Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections;
- namespace Programz
- {
- public delegate void MD ();
- class Program
- {
- public delegate string StringDel ( string text );
- static void Main ( string [] args )
- {
- string text = "Это мой рандомный текст";
- StringDel strDel = ReplaceSpaces;
- strDel ( text );
- strDel = RemoveSpaces;
- strDel ( text );
- strDel = ToJadenCase;
- strDel ( text );
- Console.WriteLine ();
- strDel = ReplaceSpaces;
- strDel += RemoveSpaces;
- strDel += ToJadenCase;
- strDel ( text );
- }
- public static string ReplaceSpaces ( string text )
- {
- text = text.Replace (' ','-');
- Console.WriteLine (text);
- return text;
- }
- public static string RemoveSpaces ( string text )
- {
- string[] str = text.Split ( ' ' );
- string newText = string.Empty;
- for ( int i = 0 ; i < str.Length ; i++ )
- {
- newText += str [i];
- }
- Console.WriteLine ( newText );
- return newText;
- }
- public static string ToJadenCase ( string text )
- {
- string [] str = text.Split ( ' ' );
- string newText = string.Empty;
- for ( int i = 0 ; i < str.Length ; i++ )
- {
- char[] symbs = str [i].ToCharArray();
- symbs [0] = char.ToUpper ( symbs [0]);
- str [i] = string.Empty;
- for ( int j = 0 ; j < symbs.Length ; j++ )
- {
- str [i] += symbs[j];
- }
- newText += str [i]+" ";
- }
- Console.WriteLine ( newText );
- return newText;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment