Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1031496 // cleanSkypeMsg (from tags and mentions)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5252L/33K).

sS cleanSkypeMsg(S content) {
  LS tok = htmlTok(content);
  new StringBuilder out;
  for (int i = 0; i < l(tok); i++) {
    ifdef cleanSkypeMsg_debug printVars(+i, t := tok.get(i)); endifdef
    if (odd(i)) {
      S tag = getTag(tok.get(i));
      ifdef cleanSkypeMsg_debug printVars(+i, +tag); endifdef
      if (!startsWith(tag, "/") && !eqicOneOf(tag, "b", "i", "at")) {
        // skip any other tags
        
        if (eqic(tag, "ss")) out.append(":" + tagParam(tok.get(i), "type") + ":");
        
        int j = findEndOfContainerTag(tok, i);
        i = j < 0 ? l(tok) : j-1;
      }
      ifdef cleanSkypeMsg_debug printVars(+i); endifdef
    } else
      out.append(htmlDecode(tok.get(i)));
  }
  ret str(out);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031496
Snippet name: cleanSkypeMsg (from tags and mentions)
Eternal ID of this version: #1031496/5
Text MD5: 8f1399ad288ac18bb8fbc81554ae2be2
Transpilation MD5: 31a54ccd5e5597a7cb8485a4f3075f14
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-16 16:20:29
Source code size: 748 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 183 / 259
Version history: 4 change(s)
Referenced in: [show references]