Post

This RegExp is O(1) if the string is `SeqOneByteString` πŸŽ‰ ```js const isOneByte = !/[^\x00-\xff]/.test(str); ```

0 reposts0 likes

However, if the string is a `SeqTwoByteString` and large it has to do a linear scan which of course is not so fast. Anyone have any tricks up their sleeves to detect if a string is a a two byte string in O(1)?