fork(16) download
  1. using System;
  2. using System.Text;
  3.  
  4. public class Test {
  5. public static void Main() {
  6. try {
  7. string cats = "\uD83D\uDE38\uD83D\uDE3E";
  8. Console.WriteLine( cats );
  9. Console.WriteLine( cats.Substring(1) );
  10. Console.WriteLine( ReverseString(cats) ); //program crashes, generates no output!
  11. Console.WriteLine( cats.Length );
  12.  
  13. string noel = "noe\u0308l";
  14. Console.WriteLine( noel );
  15. Console.WriteLine( ReverseString(noel) );
  16. Console.WriteLine( noel.Substring(0,3) );
  17. Console.WriteLine( noel.Length );
  18. Console.WriteLine( Join( ",", noel.ToCharArray() ) );
  19.  
  20. string ligature = "ba\uFB04e";
  21. Console.WriteLine( "Upper " + ligature + " => " + ligature.ToUpper() );
  22.  
  23. string cnoel = "noël";
  24. Console.WriteLine( cnoel + " == " + noel + " (" + (cnoel == noel ? "true" : "false") + ")" );
  25. Console.WriteLine( "Normalize " + cnoel + " == " + noel + " (" + (cnoel.Normalize() == noel.Normalize() ? "true" : "false") + ")" );
  26.  
  27. } catch( Exception ex ) {
  28. Console.WriteLine( ex.Message );
  29. }
  30. }
  31.  
  32. public static string ReverseString(string s) {
  33. char[] arr = s.ToCharArray();
  34. Array.Reverse(arr);
  35. return new string(arr);
  36. }
  37.  
  38. public static string Join(string j, char[] cs) {
  39. StringBuilder builder = new StringBuilder();
  40. foreach( char c in cs ) {
  41. builder.Append(c).Append(j);
  42. }
  43. return builder.ToString();
  44. }
  45. }
  46.  
Success #stdin #stdout 0.04s 33872KB
stdin
Standard input is empty
stdout
😸😾
�😾
�😸�
4
noël
l̈eon
noe
5
n,o,e,̈,l,
Upper baffle => BAfflE
noël == noël (false)
Normalize noël == noël (true)