About Store Forum Documentation Contact
Donations:
188$/mo



Post Reply 
String replace.
Author Message
b1s Offline
Member

Post: #1
String replace.
I want to use this function from "string functions.h":

PHP Code:
Str  Replace(CChar  *text,  Char   from,  Char   to                                                   ); // replace 'from' -> 'to' in 'text', Sample Usage: Replace("abcde", 'd', '7') -> "abc7e" 

But instead of "abcde" i want it to replace an existing str.

so something like:
PHP Code:
Str tmp "tempstring";
Str nonTmp Replace(tmp,"temp",""); 
nonTmp would give me just "string";

i now this is newbish.. just cant figure out what im doing wrong..
(This post was last modified: 04-13-2011 02:24 PM by b1s.)
04-13-2011 02:23 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: String replace.
you need to use this function:

Str Replace(CChar *text, CChar *from, CChar *to, Bool case_sensitive=false, Bool whole_words=false); // replace 'from' -> 'to' in 'text', Sample Usage: Replace("This is not a cat", "not ", "") -> "This is a cat"

it operates on 16-bit strings, so add L for ""

Replace(tmp, L"temp", L"");
04-13-2011 04:07 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #3
RE: String replace.
hehe.. silly me grin Thanks anyway.
04-14-2011 08:54 AM
Find all posts by this user Quote this message in a reply
Post Reply