i have a bunch of files that are basically named "totalDesiredString.txt" where "DesiredString" is a varying name throughout the files. What I'd like to do is take "totalDesiredString.txt", and strip it of it's total and it's .txt, leaving only "DesiredString", which can be used to present relevent text boxes. IE "DesiredString's Number of Pictures" blah blah.
Anyone know of a function that does what I'm doing, or a function that will, through a series of processes, lead me to where I need to be? Thanks, you've all been a great help this far.
strip text from a string
Moderator: General Moderators
Have you looked at the Manual's filesystem functions? fopen and it's associated funcs should help you out. 
i guess i don't really see how this would apply.
we're dealing strictly with strings. if you want to, pretend that "totalBlah.txt" isn't a text file, it's just a string which is "totalBlah.txt". I want to take "totalBlah.txt" and turn it into the string "Blah".
accessing the text files and what's within them I have no problem with.
thanks for the input anyway, though.
we're dealing strictly with strings. if you want to, pretend that "totalBlah.txt" isn't a text file, it's just a string which is "totalBlah.txt". I want to take "totalBlah.txt" and turn it into the string "Blah".
accessing the text files and what's within them I have no problem with.
thanks for the input anyway, though.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
If total and .txt are constant:
Mac
Code: Select all
$filename = 'totalDesiredString.txt';
$string = str_replace(array('total', '.txt'), '', $filename);