How to count the correct length of a string with emojis in javascript?

str.length gives the count of UTF-16 units. Unicode-proof way to get string length in codepoints (in characters) is […str].length as iterable protocol splits the string to codepoints. If we need the length in graphemes (grapheme clusters), we have these native ways: a. Unicode property escapes in RegExp. See for example: Unicode-aware version of \w or … Read more

How to disable emoji from being entered in Android EditText?

Modify build.gradle file, add XEditText to your project: dependencies{ compile ‘com.xw.repo:xedittext:2.0.0@aar’ } after that, in your layout.xml: <com.xw.repo.XEditText xmlns:app=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”wrap_content” app:x_disableEmoji=”true”/> Or: Customize EditText like this: public class CustomEditText extends EditText { public CustomEditText(Context context) { super(context); init(); } public CustomEditText(Context context, AttributeSet attrs) { super(context, attrs); init(); } public CustomEditText(Context context, AttributeSet attrs, … Read more

JQuery Emoji picker [closed]

After the first time I asked this question, I only got down votes. So I thought, probably there isn’t any other plugin out there and I developed my own based on Emojiarea (which also Webogram uses). Because I didn’t copy the code from Webogram, I didn’t sort the icons yet but my solution works how … Read more

How to remove emoji code using javascript?

For me none of the answers completely removed all emojis so I had to do some work myself and this is what i got : text.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g, ”); Also, it should take into account that if one inserting the string later to the database, replacing with empty string could expose security issue. instead replace with the … Read more

Convert Apple Emoji (String) to UIImage

Updated for Swift 4.1 Add this extension to your project import UIKit extension String { func image() -> UIImage? { let size = CGSize(width: 40, height: 40) UIGraphicsBeginImageContextWithOptions(size, false, 0) UIColor.white.set() let rect = CGRect(origin: .zero, size: size) UIRectFill(CGRect(origin: .zero, size: size)) (self as AnyObject).draw(in: rect, withAttributes: [.font: UIFont.systemFont(ofSize: 40)]) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() … Read more

What is the regex to extract all the emojis from a string?

Using emoji-java i’ve wrote a simple method that removes all emojis including fitzpatrick modifiers. Requires an external library but easier to maintain than those monster regexes. Use: String input = “A string 😄with a \uD83D\uDC66\uD83C\uDFFFfew 😉emojis!”; String result = EmojiParser.removeAllEmojis(input); emoji-java maven installation: <dependency> <groupId>com.vdurmont</groupId> <artifactId>emoji-java</artifactId> <version>3.1.3</version> </dependency> gradle: implementation ‘com.vdurmont:emoji-java:3.1.3’ EDIT: previously submitted answer … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)