Old Question: How SubString,Limit Using C? ,But no one did not answer my question.
i want get one index from a string.
my string may contains symbol and utf-8 character.(eg:ß
)
speed of string for me is important.
1#: w_char_t
data type good for me?
2#: how can get a character from a utf-8 string?
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <string.h>
int main()
{
wchar_t *msg1 = L"ßC Programming";
//wprintf(L" vals> %Ls\n",msg1);
//wprintf(L" vals> %s\n",msg1);
printf(" vals> %Ls %S\n",msg1,msg1);//dont show any=====>BUG
printf(" val> %Lc\n",msg1[1]);//show `C`
printf(" val> %Lc\n",msg1[0]);//dont show any=====>BUG
printf("\n");
/////////////////////////////////
char *msg2 = "ßC Programming";
printf(" vals> %s\n",msg2);//show `ßC Programming`
printf(" val> %c\n",msg2[1]);//show `�`=====>BUG
printf(" val> %c\n",msg2[0]);//show `�`=====>BUG
printf("\n");
}
Please guide me in solving problems.