search

Home  >  Q&A  >  body text

angular.js - How to determine whether a piece of text contains emoji in angular?

The project needs to replace emoji with pictures in the text information obtained from the server, but the format returned by the server is similar to this
eg:[pig_4] [pig_5] [pig_4] [pig_5] [ pig_5], how should I replace the corresponding [pig_4] with the corresponding picture? Use interception? ?

淡淡烟草味淡淡烟草味2812 days ago694

reply all(2)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-15 17:09:23

    You can use regular expressions to implement the analysis yourself
    Or see if there is an emoji library, https://github.com/search?l=J...
    Then make it filter(ng1)/pipe(ng2)

    reply
    0
  • 迷茫

    迷茫2017-05-15 17:09:23

    It’s hard to judge, emoji strings basically all start with /, and some special characters also start with /, so if you can accurately distinguish whether they are special characters, you can judge. Regex is very simple to write!

    reply
    0
  • Cancelreply