-2

I need to fetch first char of contact names (includes all language) and replace chars which don't satisfy range of char-set for selected language.

For example:- My table will be having English contacts and Chinese contacts, now if I select Chinese language then my query should give me all the first chars from the names but for English contact it should return '*'.

Any lead will be appreciated.

Tab Alleman
  • 31,483
  • 7
  • 36
  • 52
  • [Here's a good lead for you to get going](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). Plenty of useful information there. – Sam Varshavchik Dec 11 '18 at 13:26
  • @SamVarshavchik Thanks for the information but it will not help to me at this time. – srb_programming Dec 11 '18 at 13:30
  • Except this is the only help anyone can offer here. Your question boils down to "I don't know how to do this". Well, reading a C++ book is the only way to learn how to do this. You can't really expect someone on stackoverflow.com to write an entire program like that, and show it here. If there's a specific C++ question, or a problem, then it should be asked directly using a [mcve]. – Sam Varshavchik Dec 11 '18 at 13:34
  • Give an example of what you want. – Dmytro Dadyka Dec 11 '18 at 14:23
  • Something like this "SELECT (substr(FirstName, 1, 1)), unicode((substr(FirstName, 1, 1))), CASE WHEN ( 90 > (unicode((substr(FirstName, 1, 1))) > 65) AND (unicode((substr(FirstName, 1, 1))) < 90)) THEN (substr(FirstName, 1, 1)) ELSE '#' END AS Indx FROM Emp " @DmytroDadyka – srb_programming Dec 11 '18 at 14:41
  • @srb_programming. Add this to you quation (edit) – Dmytro Dadyka Dec 11 '18 at 15:52
  • How do you track what language a contact is in? – Shawn Dec 11 '18 at 17:50
  • @Shawn I would check its Unicode of contact's first char. – srb_programming Dec 12 '18 at 07:47
  • @Shawn : You may check this https://msdn.microsoft.com/en-us/library/cc233968.aspx – srb_programming Dec 13 '18 at 10:49

1 Answers1

0

Got the answer, I have created below query to achieve desired output, Unicode values are getting compared and assigned to '#' though it needs some improvement.

For English language:-

"SELECT (substr(FirstName, 1, 1)), unicode((substr(FirstName, 1, 1))), CASE WHEN ( 90 > (unicode((substr(FirstName, 1, 1))) > 65) AND (unicode((substr(FirstName, 1, 1))) < 90)) THEN (substr(FirstName, 1, 1)) ELSE '#' END AS Indx FROM Emp "

Similarly will be achieved for other languages based on their Unicode range of character set. Thanks everyone for your response. :)