63
1
using System;
2
using System.Globalization;
3
using System.Diagnostics;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
// 140字以下かどうかのチェックを行い超えている場合はconfigに従って動作する
10
//🎶🔥é- is standard length of 6, but there are ONLY 4 characters! Why not len=4?
11
//🎶🔥 are double byte UNICODE characters (> \u10000) of width or len 2 each
12
//🎶🔥é- below will replace space after lasting character '-' (position 4) with a sub using most common techniques seen online
13
14
string s = "𠇰😈🎶🔥é-";
15
string s2 = "𠇰😈🎶🔥é-";
16
Stopwatch sw = new Stopwatch();
17
18
sw.Start();
19
int typicalen = s.Length;
20
sw.Stop();
21
Console.WriteLine("Normal String {0} len = {1} in {2} ticks.",s, typicalen, sw.ElapsedTicks.ToString("N0"));
22
23
StringInfo stringInfoThrowAway = new StringInfo("Preload this function"); //Results vary if you move this before or after below implementations
24
Cached Result