Re: Emoticon text parser



On 20 Mrz., 19:01, "Peter Duniho" <NpOeStPe...@xxxxxxxxxxxxxxxx>
wrote:
On Thu, 20 Mar 2008 10:40:39 -0700, Karsten Wutzke <kwut...@xxxxxx> wrote:
how do I write a text parser that will detect many ":-)", "]:->"
strings so that they can be replaced with small icons a text
component?

That all depends on how you're formatting the text to include the icons.

But, for example, if you're using HTML in one of the Swing controls that
can display HTML, you might just use the java.util.regex package useful.
Just use it to do a straight search-and-replace of emoticon strings with
the appropriate HTML "img" tag.

Other than that, your question is pretty broadly worded. You're either
going to get a lot of replies that aren't applicable, or none at all due
to the vagueness of the problem description.

Pete

The strings to be parsed are (at first) plain strings without any
control codes or any programming language constructs... but they
contain completely differing smiley/emoticon code, where some codes
might contain other, so I have to figure that out:

Example:

one might express *very sad* or *weeping* by writing the string ":-(("
this smiley code however starts with ":-(", the smiley code for *sad*
or *unhappy*...

OK solution here would be to sort the order of smileys tested against
by their code string length, here first check ":-((", then ":-("...

But I need some general parsing approach. Regex really necessary?
Pattern? Looks very complicated to me... I doubt I can use a pattern
for codes that range from ":-)" over "}:->" over ";)" to (CIG)...

Karsten
.



Relevant Pages

  • Re: Wie soll ich mit Ressourcen umgehen?
    ... Beide Projekte enthalten Strings und Icons. ... Ich möchte nun in Projekt A diverse Strings, ... Dim lResMan As _ ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: is donation a commercial activity?
    ... I found lots of icons "with strings attached". ... like photos: You can easily find thousands, ... then once you start reading the fine print it's ...
    (microsoft.public.vb.general.discussion)
  • Re: Emoticon text parser
    ... strings so that they can be replaced with small icons a text ... But, for example, if you're using HTML in one of the Swing controls that can display HTML, you might just use the java.util.regex package useful. ... Just use it to do a straight search-and-replace of emoticon strings with the appropriate HTML "img" tag. ...
    (comp.lang.java.programmer)
  • Help with custom properties in my own control
    ... I have my own control and can add properties that are integers or strings or ... icons or whatever. ... but my custom strings. ... André Nogueira ...
    (microsoft.public.dotnet.languages.vb)
  • Re: FAQ Topic - How do I access a frames content? (2009-10-25)
    ... Dr J R Stockton wrote: ... you are not reading any files "HTML or TXT, as it exists on disc" - ... "Given an array of strings with the minimum 2 and the maximum 1o ... find the shortest common word in these strings. ...
    (comp.lang.javascript)