fork(1) download
  1. using System;
  2. using System.Globalization;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. Console.WriteLine("🔹".Length);
  9. Console.WriteLine(new StringInfo("🔹").LengthInTextElements);
  10.  
  11. var myString = @"This is a string before an emoji:🔹This is after the emoji.";
  12. var teMyString = new StringInfo(myString);
  13. Console.WriteLine(teMyString.SubstringByTextElements(0, 33));
  14. Console.WriteLine(teMyString.SubstringByTextElements(0, 34));
  15. Console.WriteLine(teMyString.SubstringByTextElements(0, 35));
  16.  
  17. }
  18. }
Success #stdin #stdout 0.01s 131072KB
stdin
Standard input is empty
stdout
2
1
This is a string before an emoji:
This is a string before an emoji:🔹
This is a string before an emoji:🔹T