Click here to Skip to main content
15,892,537 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to parse VC++ CPP file and get all function name with argument name? Pin
CPallini25-Nov-10 23:30
mveCPallini25-Nov-10 23:30 
QuestionArray of images Pin
T.RATHA KRISHNAN25-Nov-10 20:24
T.RATHA KRISHNAN25-Nov-10 20:24 
AnswerRe: Array of images Pin
visualheadsky25-Nov-10 20:40
visualheadsky25-Nov-10 20:40 
AnswerRe: Array of images Pin
yu-jian26-Nov-10 6:43
yu-jian26-Nov-10 6:43 
QuestionHelp: rename filename Pin
animal12325-Nov-10 19:00
animal12325-Nov-10 19:00 
QuestionRe: Help: rename filename Pin
CPallini25-Nov-10 21:24
mveCPallini25-Nov-10 21:24 
AnswerRe: Help: rename filename Pin
Richard MacCutchan25-Nov-10 21:51
mveRichard MacCutchan25-Nov-10 21:51 
AnswerRe: Help: rename filename [modified] Pin
Alain Rist27-Nov-10 23:19
Alain Rist27-Nov-10 23:19 
Hi,
As already stated by Richard you need to map the accented characters to their non-accented counterpart.

Here is a way of doing it, with your inputs:
#include <string>
#include <algorithm>
#include <iostream>	

struct StringChanger
{
	struct CharChanger
	{
		std::wstring change;
		CharChanger(const std::wstring str) : change(str)
		{}
		wchar_t operator()(wchar_t wc)
		{
			return change.find(wc) != change.npos ? change[0] : wc;
		}
	} changer;

	StringChanger(const std::wstring& str) : changer(str)
	{}
	void operator()(std::wstring& s)
	{
		std::transform(s.begin(), s.end(), s.begin(), changer);
	}
};

StringChanger changers[] = 
{
	L"aàáảãạăằắẳẵặâầấẩẫậ",
	L"AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬ",
	L"OÒÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢ",
	L"EÈÉẺẼẸÊỀẾỂỄỆ",
	L"UÙÚỦŨỤƯỪỨỬỮỰ",
	L"IÌÍỈĨỊ",
	L"YỲÝỶỸỴ",
	L"DĐ",
	L"oòóỏõọôồốổỗộơờớởỡợ", 
	L"eèéẻẽẹêềếểễệ", 
	L"uùúủũụưừứửữự", 
	L"iìíỉĩị", 
	L"yỳýỷỹỵ", 
	L"dđ"
};

int main()
{
	std::wstring str = L" người mình.mp3 ";
	std::wcout << str << std::endl;

	for (StringChanger* s = changers; s < changers + sizeof changers / sizeof StringChanger; ++s)
		(*s)(str);

	std::wcout << str << std::endl;
	return 0;
}


cheers,
AR

Edit: This is not very efficient, see a better way requiring VC2010 here[^].
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
modified on Sunday, November 28, 2010 4:31 PM

QuestionHow can find out port name? Pin
Le@rner25-Nov-10 18:54
Le@rner25-Nov-10 18:54 
AnswerRe: How can find out port name? Pin
Richard MacCutchan25-Nov-10 21:53
mveRichard MacCutchan25-Nov-10 21:53 
QuestionHow can merge data of diffrent array in single array? Pin
Le@rner25-Nov-10 18:23
Le@rner25-Nov-10 18:23 
AnswerRe: How can merge data of diffrent array in single array? Pin
CPallini25-Nov-10 21:50
mveCPallini25-Nov-10 21:50 
Questionerror C3861: "xxxxx" identifier not found Pin
AmbiguousName25-Nov-10 4:52
AmbiguousName25-Nov-10 4:52 
AnswerRe: error C3861: "xxxxx" identifier not found Pin
Richard MacCutchan25-Nov-10 5:16
mveRichard MacCutchan25-Nov-10 5:16 
GeneralRe: error C3861: "xxxxx" identifier not found Pin
AmbiguousName25-Nov-10 6:52
AmbiguousName25-Nov-10 6:52 
GeneralRe: error C3861: "xxxxx" identifier not found Pin
CPallini25-Nov-10 7:13
mveCPallini25-Nov-10 7:13 
GeneralRe: error C3861: "xxxxx" identifier not found Pin
AmbiguousName25-Nov-10 7:26
AmbiguousName25-Nov-10 7:26 
GeneralRe: error C3861: "xxxxx" identifier not found Pin
CPallini25-Nov-10 8:04
mveCPallini25-Nov-10 8:04 
QuestionTCP IP socket goes up and down Pin
nahitan25-Nov-10 3:41
nahitan25-Nov-10 3:41 
AnswerRe: TCP IP socket goes up and down Pin
Code-o-mat25-Nov-10 6:14
Code-o-mat25-Nov-10 6:14 
GeneralRe: TCP IP socket goes up and down Pin
nahitan25-Nov-10 6:29
nahitan25-Nov-10 6:29 
GeneralRe: TCP IP socket goes up and down Pin
Code-o-mat25-Nov-10 7:34
Code-o-mat25-Nov-10 7:34 
GeneralRe: TCP IP socket goes up and down Pin
nahitan25-Nov-10 7:42
nahitan25-Nov-10 7:42 
GeneralRe: TCP IP socket goes up and down Pin
Code-o-mat25-Nov-10 7:48
Code-o-mat25-Nov-10 7:48 
GeneralRe: TCP IP socket goes up and down Pin
Code-o-mat25-Nov-10 7:42
Code-o-mat25-Nov-10 7:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.