Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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"
 
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.
the_general_problem.png

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...
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top