Well there I was trying to think of an idea for a blog (u_u) when it suddenly occurred to me (*_*) that I should do a nice little SQL function on Emoticons. It was a happy thought (^_^) which made me smile (n_n). I was amazed (^.^) and astonished (*^*) sometimes incredulous (o_O) at the variety of manga emoticon (verticon) around. Call me an old fool if you like, (>x<!) but I think they're cool!
I'd never felt the need to add emoticons to my writing (ñ_ñ). My problem is in remembering them (O_O). I get a bit confused by them. (p_q) However, I now find them enormously useful *(^O^)* as many people who use english as a second language find my irony, sarcasm, hyperbole and invective entirely incomprehensible. (-_-;) I suspect the other bloggers will be jealous 8(>_<)8 at my new cool powers of communication (ò_ó) I was a bit apprehensive (._.) about the time it would take to write a function to interpret them
True enough, typing them in sas boring (=_=). At one point, I felt sleepy (z_z) and I must have dozed off (-_-) at the keyboard m(_ _)m. I woke up with an inprint of the keyboard on my forehead.(X_X) Glancing around \\(<.<|>.>)// I realise I'd still not finished the blog entry (>_<) which made me cross (ò_ó). Oh dear, no blog entry (._.) and the editor would be cross (¬_¬") mad (ò_ó) or angry (>x<!). My readers would, on the other hand, be sad (T_T), possibly even crying (;_;). Well, certainly one or two might be miserable (!_!)
Oh dear, better get on with it (-_-;). Actually it wasn't too hard w(^o^)W, after one got over the initial shock (/_\) so here it is finished (^_~). (^o^)y
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
CREATE function [dbo].[ufsMangaMeaning]
(
@Emoticon NVARCHAR(80)
)
RETURNS NVARCHAR(20) AS
BEGIN
RETURN
CASE @emoticon
WHEN '(^_^)' THEN 'happy'
WHEN '(u_u)' THEN 'exasperated'
WHEN '(*_*)' THEN 'euphoric'
WHEN '(O_O)' THEN 'shocked'
WHEN '(^_~)' THEN 'winking'
WHEN '(^.^)' THEN 'amazed'
WHEN '(n_n)' THEN 'smiling'
WHEN '(._.)' THEN 'apprehensive'
WHEN '(-_-)' THEN 'sleeping'
WHEN '(;_;)' THEN 'crying'
WHEN '(T_T)' THEN 'sad'
WHEN '(@_@)' THEN 'dizzy'
WHEN '(O_O)' THEN 'amazed'
WHEN '(*^*)' THEN 'astonished'
WHEN '(>_<)' THEN 'pained'
WHEN '(^o^)' THEN 'glad'
WHEN '*(^O^)*' THEN 'happier'
WHEN '(¬_¬)' THEN 'angry'
WHEN '(¬_¬")' THEN 'pissed off'
WHEN '(X_X)' THEN 'dead'
WHEN '(=_=)' THEN 'bored'
WHEN '(*-*)' THEN 'pleased'
WHEN '(!_!)' THEN 'miserable'
WHEN '(o_O)' THEN 'incredulous'
WHEN '(*O*)' THEN 'amazed'
WHEN '(-O-)' THEN 'pretentious'
WHEN '([o])' THEN 'crying'
WHEN '\(<.<|>.>)//' THEN 'Glancing around'
WHEN '([-])' THEN 'crying'
WHEN '(p_q)' THEN 'confused'
WHEN '(o_o)' THEN 'seriously?'
WHEN '(;O;)' THEN 'weeping'
WHEN '(_O_)' THEN 'exasperated'
WHEN '(.O.'')' THEN 'confused'
WHEN '(-_-;)' THEN 'contrite' --'i messed it up'
WHEN '(''_'')' THEN 'serious'
WHEN '(?_?)' THEN 'puzzled'
WHEN '(''O'')' THEN 'singing'
WHEN 'm(_ _)m' THEN 'sleeping on the desk'
WHEN 'w(^o^)W' THEN 'wow'
WHEN '(/_\)' THEN 'dispairing'
WHEN '(=^_^=)' THEN 'cattish'
WHEN '(u_u)' THEN 'low'
WHEN '(Ú_Ú)' THEN 'depressed'
WHEN '(>x<!)' THEN 'furious'
WHEN '(*¬*)' THEN 'drooling'
WHEN '(Ñ_Ñ)' THEN 'insincere'
WHEN '(Y_Y)' THEN 'infinite sadness'
WHEN '($_$)' THEN 'aquisitive'
WHEN '(Ò_Ó)' THEN 'mad'
WHEN '(?_?)' THEN 'amorous'
WHEN '(xOx)' THEN 'dispairing'
WHEN '(>O<)' THEN 'revolted'
WHEN '(-_o)' THEN 'winking'
WHEN '8(>_<)8' THEN 'jealous'
WHEN '(z_z)' THEN 'sleepy'
WHEN '(^o^)y' THEN 'congratulatory'
ELSE @emoticon
END
END
--select dbo.ufsMangaMeaning('8(>_<)8')
GO
CREATE function [dbo].[ufsMangaEmoticon]
(
@Emotion NVARCHAR(80)
)
RETURNS NVARCHAR(20) AS
BEGIN
RETURN
CASE @emotion
WHEN 'happy' THEN'(^_^)'
WHEN 'exasperated' THEN '(u_u)'
WHEN 'euphoric' THEN '(*_*)'
WHEN 'shocked' THEN '(O_O)'
WHEN 'winking' THEN '(^_~)'
WHEN 'amazed' THEN '(^.^)'
WHEN 'smiling' THEN '(n_n)'
WHEN 'apprehensive' THEN '(._.)'
WHEN 'sleeping' THEN '(-_-)'
WHEN 'crying' THEN '(;_;)'
WHEN 'sad' THEN '(T_T)'
WHEN 'dizzy' THEN '(@_@)'
WHEN 'amazed' THEN '(O_O)'
WHEN 'astonished' THEN '(*^*)'
WHEN 'pained' THEN '(>_<)'
WHEN 'glad' THEN '(^o^)'
WHEN 'happier' THEN '*(^O^)*'
WHEN 'angry' THEN '(¬_¬)'
WHEN 'pissedOff' THEN '(¬_¬")'
WHEN 'dead' THEN '(X_X)'
WHEN 'bored' THEN '(=_=)'
WHEN 'pleased' THEN '(*-*)'
WHEN 'miserable' THEN '(!_!)'
WHEN 'incredulous' THEN '(o_O)'
WHEN 'amazed' THEN '(*O*)'
WHEN 'pretentious' THEN '(-O-)'
WHEN 'crying' THEN '([o])'
WHEN 'GlancingAround' THEN '\(<.<|>.>)//'
WHEN 'crying' THEN '([-])'
WHEN 'confused' THEN '(p_q)'
WHEN 'seriously?' THEN '(o_o)'
WHEN 'weeping' THEN '(;O;)'
WHEN 'exasperated' THEN '(_O_)'
WHEN 'confused' THEN '(.O.'')'
WHEN 'contrite' THEN '(-_-;)' --'i messed it up'
WHEN 'serious' THEN '(''_'')'
WHEN 'puzzled' THEN '(?_?)'
WHEN 'singing' THEN '(''O'')'
WHEN 'sleepingOnTheDesk' THEN 'm(_ _)m'
WHEN 'wow' THEN 'w(^o^)W'
WHEN 'dispairing' THEN '(/_\)'
WHEN 'cattish' THEN '(=^_^=)'
WHEN 'low' THEN '(u_u)'
WHEN 'depressed' THEN '(Ú_Ú)'
WHEN 'furious' THEN '(>x<!)'
WHEN 'drooling' THEN '(*¬*)'
WHEN 'insincere' THEN '(Ñ_Ñ)'
WHEN 'infinitly sad' THEN '(Y_Y)'
WHEN 'aquisitive' THEN '($_$)'
WHEN 'mad' THEN '(Ò_Ó)'
WHEN 'amorous' THEN '(?_?)'
WHEN 'dispairing' THEN '(xOx)'
WHEN 'revolted' THEN '(>O<)'
WHEN 'winking' THEN '(-_o)'
WHEN 'jealous' THEN '8(>_<)8'
WHEN 'sleepy' THEN '(z_z)'
WHEN 'congratulating' THEN '(^o^)y'
ELSE @emotion
END
END
--select dbo.ufsMangaMeaning('8(>_<)8')
GO
CREATE function [dbo].[ufsEmotify]
(
@String NVARCHAR(4000),
@prefix VARCHAR(80)='',
@suffix VARCHAR(80)=''
)
/*
*/
RETURNS NVARCHAR(4000) AS
BEGIN
DECLARE @Where INT
DECLARE @len INT
WHILE 1 = 1
BEGIN
SELECT @where=CHARINDEX( '#', ISNULL(@String,'') )
--If we are out of % placeholders return the @String
IF @where = 0 BREAK
SELECT @len= PATINDEX('%[^a-z]%', SUBSTRING(@String,@Where+2,4000)+'*')
SELECT @String =
STUFF( @String, @where, @len+1,
@Prefix
+dbo.ufsMangaEmoticon(SUBSTRING(@String,@where+1,@len))
+@Suffix)
END
RETURN (@String)
END
GO
SELECT dbo.ufsEmotify('<p>Well there I was trying to think of an idea
for a blog #exasperated when it suddenly occurred to me #euphoric that
I should do a nice little SQL Function on Emoticons. It was a happy thought
#happy which made me smile #smiling. I was amazed #amazed and astonished
#astonished sometimes incredulous #incredulous at the variety of emoticon.
</p><p>I''d never felt the need to add emoticons to my writing #insincere.
My problem is in remembering them #shocked. I get a bit confused by them.
#confused However, I now find them enormously useful #happier as many people
who use english as a second language find my irony, sarcasm, hyperbole
and invective entirely incomprehensible. #contrite I suspect the other
bloggers will be jealous #jealous at my new cool powers of communication #mad
I was a bit apprehensive #apprehensive about the time it would take to write
a function to interpret them</p><p>True enough, typing them in sas boring
#bored. At one point, I felt sleepy #sleepy and I must have dozed off
#sleeping at the keyboard #sleepingonthedesk. I woke up with an inprint
of the keyboard on my forehead.#dead Glancing around #Glancingaround I
realise I''d still not finished the blog entry #pained which made me cross
#mad. Oh dear, no blog entry #apprehensive and the editor would be cross
#pissedoff mad #mad or angry #furious. My readers would, on the other hand,
be sad #sad, possibly even crying #crying. Well, certainly one or two might
be miserable #miserable </p><p>Oh dear, better get on with it #contrite.
Actually it wasn''t too hard #wow, after one got over the initial shock
#dispairing so here it is finished #winking. #congratulating </p>', '<font
size="2" face="Courier New" color="Green">','</font>')