mikroC splitstring function?

General discussion on mikroElektronika website & forums.
Post Reply
Author
Message
ventete
Posts: 20
Joined: 26 Mar 2011 21:09

mikroC splitstring function?

#1 Post by ventete » 22 Nov 2015 02:15

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

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: mikroC splitstring function?

#2 Post by Aleksandar.Mitrovic » 24 Nov 2015 16:41

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

ventete
Posts: 20
Joined: 26 Mar 2011 21:09

Re: mikroC splitstring function?

#3 Post by ventete » 26 Nov 2015 20:40

Aleksandar,
thank you very much for your help. I appreciate it.

Marc

Post Reply

Return to “Website & Forums General Discussion”