Advertisement
Tues

2 st Projekt

May 25th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 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 ConsoleApp3
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string[] array = Methode("Hallo Welt und Rest der Nation");
  14.  
  15. string a = array[0];
  16. string b = array[1];
  17.  
  18. Console.WriteLine(a);
  19. Console.WriteLine(b);
  20.  
  21. Console.ReadKey();
  22. }
  23.  
  24. static string[] Methode(string v)
  25. {
  26.  
  27.  
  28.  
  29. string a = "";
  30. string b = "";
  31. char c = ' ';
  32. bool vorBlank = true;
  33.  
  34.  
  35. for (int i = 0; i < v.Length; i++)
  36. {
  37. c = v[i];
  38.  
  39. if (c == ' ' && vorBlank)
  40. {
  41. vorBlank = false;
  42. }
  43. else
  44. {
  45. if (vorBlank)
  46. {
  47. a += c;
  48. }
  49. if (!vorBlank)
  50. {
  51. b += c;
  52. }
  53. }
  54.  
  55. }
  56.  
  57. return new string[] { a, b };
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement