HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Using strings

02-15-2005, 05:37 PM#1
Perfectwingzero
Whats the best way to replace a certain letter in a string for example

string "abcde"
relace bc with "ss"
02-15-2005, 05:56 PM#2
D0nk1ckh0t
Do you only need to replace a LETTER or a LETTER COMBINATION consisting of several letters?
Please make it more clear.
02-15-2005, 08:21 PM#3
ThyFlame
Sounds like you want to run a 2 dimensional loop with a substring with an IF/THEN/ELSE for every combination of letters you want to replace.

Ie, loop a 1-length of string
loop b 1-length of string

IF
substring(string you're using(integer a, integer b) == phrase
THEN
Whatever
ELSE
Whatever

IF
substring(string you're using(integer a, integer b) == phrase 2
et cetera

This should check every combination of letters in the string, I may have messed up with how I did the substring (I forget if the second number is how far it goes or the place of the letter it stops at, since I recall a difference from one of the languages I code in. It's been quite awhile, though )