Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replace function with diacritics 1

Status
Not open for further replies.

tuzojazz

Programmer
Dec 26, 2005
58
MX
Hi guys!

I have this code

PRINT REPLACE('EÉ', 'É' , 'X' )

and I get this

XX

and I want to consider diacritics to get

EX

how can I do it?

Thanks!
 
You need to use an accent sensitive collation. There are several to choose from. The one I use in the example below is also case sensitive.

Code:
PRINT REPLACE('EÉ', 'É' [!]collate Latin1_General_BIN[/!], 'X')

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Like I said... Latin1_General_Bin is also case sensitive, so...

Code:
PRINT REPLACE('Ee', 'E' collate Latin1_General_BIN, 'X')
-- Returns Xe

PRINT REPLACE('Ee', 'e' collate Latin1_General_BIN, 'X')
-- Returns EX

There's a ton of collations to choose from:


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Note that you can put the collate clause on any of the three string literals in the replace expression... or on all three if you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top