String Problems
Posted: Thu Nov 10, 2005 7:33 pm
Hey all!
Although I'm not a noob programmer, I'm a noob PHPer
</ego boost>
Hmm.. how can I explain this? Okay, so I'm trying to this this convertion program that would take a string like this:
HDKRFG:DJFGKJN &GFKDJN& : DSFLKJNDSF&DJNDF:GSG
and convert it with something else.
Now, lets say I'm trying to convert all "DJ"s into "HG"s. that would be:
HDKRFG:DJFGKJN &GFKDJN& : DSFLKJNDSF&DJNDF:GSG
However, I need to ignore everything between two &s and an & and a : . So, this is what would have to be ignored:
HDKRFG:DJFGKJN &GFKDJN& : DSFLKJNDSF&DJNDF:GSG
Everything in olive is ignored, thus only the "DJ" in green has to be converted.
How in the world am I gonna do that? I've been trying to work with str_replace, but have gotten nowhere
</ego degration>
Also: is there a function that finds and/or deletes the first few characters in a string?
Although I'm not a noob programmer, I'm a noob PHPer
Hmm.. how can I explain this? Okay, so I'm trying to this this convertion program that would take a string like this:
HDKRFG:DJFGKJN &GFKDJN& : DSFLKJNDSF&DJNDF:GSG
and convert it with something else.
Now, lets say I'm trying to convert all "DJ"s into "HG"s. that would be:
HDKRFG:DJFGKJN &GFKDJN& : DSFLKJNDSF&DJNDF:GSG
However, I need to ignore everything between two &s and an & and a : . So, this is what would have to be ignored:
HDKRFG:DJFGKJN &GFKDJN& : DSFLKJNDSF&DJNDF:GSG
Everything in olive is ignored, thus only the "DJ" in green has to be converted.
How in the world am I gonna do that? I've been trying to work with str_replace, but have gotten nowhere
</ego degration>
Also: is there a function that finds and/or deletes the first few characters in a string?