stefan1919

StringLength

Sep 27th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication7
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             string input = Console.ReadLine();
  15.             Console.WriteLine(CheckFillString(input));
  16.         }
  17.        static string CheckFillString(string someString)
  18.         {
  19.             StringBuilder check = new StringBuilder();
  20.             if (someString.Length >= 20)
  21.             {
  22.               for (int i = 0; i < 20; i++)
  23.             {
  24.                 check.Append(someString[i]);
  25.             }
  26.             }
  27.             else
  28.             {
  29.                 for (int j = 0; j < someString.Length; j++)
  30.                 {
  31.                     check.Append(someString[j]);
  32.                 }
  33.                 for (int p = 0; p < 20 - someString.Length; p++)
  34.                 {
  35.                     check.Append("*");
  36.                 }
  37.             }
  38.             return check.ToString();
  39.         }
  40.        
  41.    
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment