TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Remove Accents/Diacritics from a String with C#
Jhonathan Soares
May 20
2016
Code
34.5
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
public
static
string
RemoveAccents(
this
string
text){
StringBuilder sbReturn =
new
StringBuilder();
var arrayText = text.Normalize(NormalizationForm.FormD).ToCharArray();
foreach
(
char
letter
in
arrayText){
if
(CharUnicodeInfo.GetUnicodeCategory(letter) != UnicodeCategory.NonSpacingMark)
sbReturn.Append(letter);
}
return
sbReturn.ToString();
}
Accents
c#