æ²é¡ã®éããéªç«ããããããªè©±ããã¦ãã®ã§æ¸ãã¦ã¿ã¾ããã
ãã¦ã©ããã£ã¦140æåãæ°ãããã140æåãæ°ããã®ã¯æå¤ã¨å¤§å¤ã§ãèæ ®ããªãã¨ãããªããã¨ã軽ããããã¨
- CRLFã2æåã«è¦ãããã©1æåã¨ãã¦æ°ãã
- ãµãã²ã¼ããã¢ãå«ãæåã2æåã«è¦ãããã©ãã£ã¡ã1æåã¨ãã¦æ°ãã
- URLã¯22æåã«ãã
- ã§ãHTTPSã¯23æåã«ãã
- ãããç»åãæ·»ä»ããã¨ææ°ã«ããããã23æåã¨ãã¦æ°ãã
- ãã¨ãã£ã¦ã¦ã¼ã¶åã¨ãã¹ã¯ã¼ããå«ãURLã¯ãã®ã¾ã¾æ°ãã
- ããã«"."ã2å以ä¸å«ãccTLDã¯ã¹ãã¼ã ããªãã¦ã22æåã¨ãã¦æ°ãã
- ã¨ãããgTLDã®å ´åã¯"."ã1å以ä¸å«ãå ´å22æåã¨ãã
ãªã©ãªã©ãä»ã«ããã£ã±ããã£ã¦é常ã«ããã©ãããã§ãã
ããã§ã¨ãããã諦ãã¦ãããã¤ããã¾ãã
èããããªããããããããæãã«ãã¦ãããåããã¤ã§ãã
ããã使ã£ã¦140æåãæ°ããã³ã¼ãããã¡ãã
public static int TweetLength(this string s) { var validator = new Validator(); return validator.GetTweetLength(s) - CountCrLf(s); } private static int CountCrLf(string s) { int n = 0, p = -2; while ((p = s.IndexOf("\r\n", p + 2)) >= 0) n++; return n; }
CRLFã2æåã¨ãã¦æ°ãã¦ãã¾ãåé¡ã¯æ®ã£ã¦ããã®ã§ãCRLFãæ¢ãã¦ãã®åæ¸ããã¦ã¤ãã¤ã¾åããããã¶ã大ä¸å¤«ãªã¯ãã