Hi, as you may no i am working on some serial communications code, to communicate with my elecronics project.
Here is the deal, i have a string:
s654us23us456us234us2us34
Now, the string will always be 2 letters followed by some numbers, but here may be 1, 2 or 3 numbers depending on what is happening.
I can split a string like this:
us23us456us234us2
Into arrays. BUT my problem is with the strings in that the end part may be cut off as with the start.
So if the first 2 characters are letters then the start is fine. If not then the first letter (if there is one) and numbers must be deleted so that the first 2 characters are letters.
The end is different, if a number is present as the last character:
all numbers deleted in reverse order (going back through the string), and then deleting the 2 letters.
If a letter is present at the end then just the letters at the end need deleting.
I have tried myself to do this, but i am within weeks of starting C++ so need any help possible.
I hope i have explained things well enough for you to understand and help me.
Thank You,
- Martyn