Section#1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
int main(int argc, char **argv)
{
static const unsigned char text[] = "000ßh123456789";
int32_t current=1;
int32_t text_len = strlen(text)-1;
/////////////////////////////////
printf("Result : %s\n",text);
/////////////////////////////////
printf("Lenght : %d\n",text_len);
/////////////////////////////////
printf("Index0 : %c\n",text[0]);
printf("Index1 : %c\n",text[1]);
printf("Index2 : %c\n",text[2]);
printf("Index3 : %c\n",text[3]);//==> why show this `�`?
printf("Index4 : %c\n",text[4]);//==> why show this `�`?
printf("Index0 : %c\n",text[5]);
/////////////////////////////////
return 0;
}
why text[3]
and text[4]
show �
?
how can also support utf-8 character in Index
?
Section#2
I want write a function like mb_substr
in php.
(verybigstring or string)
mb_substr ( (verybigstring or string)
input , (verybigint or int)
start [, (verybigint or int)
$length = NULL ] )
Some Example:
mb_substr("hello world",0);
==>
hello world
mb_substr("hello world",1);
==>
ello world
mb_substr_two("hello world",1,3);
==>
el
mb_substr("hello world",-3);
==>
rld
mb_substr_two("hello world",-3,2);
==>
rldhe
My Question is Section#1
Can anyone help me?(please)