|
-
May 11th, 2004, 11:22 PM
#1
Inseart a character in between a String
Hi,
I have the following string
a = "12345 , Hae a nice day"
I need to insert a character "v" in beween "ae" in the string to make it
a = "12345 , Have a nice day"
This has to be done for all the occurances of the "ae".
Is there any function availabe to do this.
Regards,
Varadha
-
May 11th, 2004, 11:31 PM
#2
try this:
Code:
int idx = strInput.Find("ae");
while(idx != -1)
{
strInput.Insert(idx + 1, 'v')
idx = strInput.Find("ae");
}
I hope this helps.
Owen/
"Hhmn... You are damned if you do; and you are damned if you don't." -- bart simpson
-
May 12th, 2004, 12:04 AM
#3
here i am using a Char array and i am not using CString.
is there any C function which i can use to accomplish this..
-
May 12th, 2004, 01:10 AM
#4
I don't think so, pal. You got to code it.
-
May 12th, 2004, 07:30 AM
#5
You could use a CString and its Replace function, then copy tha resulting string back to you char array.
It would help to be specific when asking questions. There is an STL string type, an MFC CString, and char arrays, all of which behave differently. It wasn't clear from your post you were using a char array.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|