Hello,
I have strings like these:
$line = "Item <name> xxx stock, costs yyy and will sell for amount zzz";
Problem is <name> can consist of 1..n words. Most items are single words,
but some are up to 8 in my example, and there are is no set maximum (well,
max is 80 chars I believe, have to look in the stock db, not too relevant I
think)
I found this out the hard way. I thought I was clever (never do that again)
by doing this:
$words = explode (" ", $line);
$itemname = $words [1];
This only works for single-word names.
Now I want to create or use an existing function that simply copies
everything between Item and the first numerical substr.
The function then should look like:
$itemname = GetSubStr ("Item" , <numerical> , $line);
<numerical> should be a template of some sort I think.
Hope I make myself clear, can you help me ?
TIA
Pjotr
I have strings like these:
$line = "Item <name> xxx stock, costs yyy and will sell for amount zzz";
Problem is <name> can consist of 1..n words. Most items are single words,
but some are up to 8 in my example, and there are is no set maximum (well,
max is 80 chars I believe, have to look in the stock db, not too relevant I
think)
I found this out the hard way. I thought I was clever (never do that again)
by doing this:
$words = explode (" ", $line);
$itemname = $words [1];
This only works for single-word names.
Now I want to create or use an existing function that simply copies
everything between Item and the first numerical substr.
The function then should look like:
$itemname = GetSubStr ("Item" , <numerical> , $line);
<numerical> should be a template of some sort I think.
Hope I make myself clear, can you help me ?
TIA
Pjotr
Comment