How to manipulate a string

Status
Not open for further replies.

polashd

Member
How can I put a charecter (or more) inside a string.

eg. abc="string";
xyz="a";
result would be like "straing"
 
What language?? Is it always in the same position?? Is it always 1 character??
 
How can I put a charecter (or more) inside a string.

eg. abc="string";
xyz="a";
result would be like "straing"

1. Search for the place you want to insert the "a".. or just decide the place.
2. Move every character after that point forward by one place.
3. write "a" to the desired position.
 
(sorry for incomplete question)

You are going to get incomplete answers with incomplete questions. I could write some code if you are willing to tell me (us) what exactly you want. It is very difficult to write code for the general problem.


For starters read this: https://www.nongnu.org/avr-libc/user-manual/group__avr__string.html

EDIT: The info I (we) need is how to determine the position where to insert the characters. And is the length of inserted characters known or do you need some code to find that out..
 
Last edited:
I still don't know the language!!! Are we to assume asm?

If so the data ( string ) will be in an array...
When writing the array you stop at the desired position...
Write the new array...
Then carry on with the first array...
 
Oops... My bad... I thought winavr was an IDE... Sorry.... Well then much easier just read through the string library documentation.... C is designed for string manipulation..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…