|
-
Mar 5th, 2001, 02:45 PM
#1
Thread Starter
Lively Member
Ok, I have two RichText-boxes, and when pressing a button I want to replace a certain part of the first RichTextBox with the content in the second. How do I do this?
-
Mar 5th, 2001, 06:32 PM
#2
Frenzied Member
Mike (Parksie) wrote this example for me:
Code:
#include <String>
using namespace std;
bool StringFind(String sSearchIn, String sSearchFor, uint &nPos) {
uint nTemp = sSearchIn.find(sSearchFor);
If(nTemp < sSearchIn.length()) {
nPos = nTemp;
Return True;
}
Return False;
}
bool Replace(String &sLine, String sReplaceWhat, String sReplaceWith) {
uint nPos = 0;
uint i = 0;
While (StringFind(sLine, sReplaceWhat, nPos)) {
If(i > 100) break; // Something's gone wrong (sReplaceWhat ~= sReplaceWith)
sLine = sLine.replace(nPos, sReplaceWhat.length(), sReplaceWith);
i++;
}
If(i) Return True; Return False;
}
Have fun, and don't thank me, it was parksie's
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Mar 6th, 2001, 01:07 PM
#3
Monday Morning Lunatic
Bugger...looks like VB-W just destroyed my capitalisation
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 6th, 2001, 06:22 PM
#4
Frenzied Member
I think that's Geoff's VbWorld browser then
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
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
|