Page 1 of 1

mikroC splitstring function?

Posted: 22 Nov 2015 02:15
by ventete
I am using MIKROC and can find no "split string" function. I have a string 6 characters long and need to split out the last 3. The first 3 are letters and I managed to seperate them using "memmove" from the C_string library; how do I get the next 3 that are digits?

Any suggestions would be appreciated.

Thank you, Marc

Re: mikroC splitstring function?

Posted: 24 Nov 2015 16:41
by Aleksandar.Mitrovic
Hi Marc,

You can try to write code like this:

Code: Select all

char first[]= "mikroElektronika";
char second[16];
char third[16];

main(){
 strncpy(second, first ,5);
 strncpy(third, first+5 ,11);
}
Result will be:
second = "mikro"
third = "Elektronika"

Best regards,
Aleksandar

Re: mikroC splitstring function?

Posted: 26 Nov 2015 20:40
by ventete
Aleksandar,
thank you very much for your help. I appreciate it.

Marc