Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulating strings 1

Status
Not open for further replies.

khanza

Technical User
Feb 20, 2003
70
US
I need to take something like this --
"I am worth $80.00"

and turn it into two variables,

"i am worth $" and "80.00"

Or even better 3
"i am worth"
"$"
"80.00"


Any help in the right direction would be greatly appreciated!

khan
 
What are the criteria for splitting the string? Is it that you want to separate the numeric from the non-numeric, and the dollar sign from the rest of the non-numeric? What if there isn't a dollar sign? What if there is only non-numeric? You're missing a clear explanation of what you attempting.

Lee
 
I just need the number from the rest of the string.


Thanks for your reply!

Khan
 
And this is a couple of static choices -- so there will always be numeric, and there will always be a dollar sign
 
As i see the dollar will always exist so:


$StingName = "I am worth $80.00";
$ArrayName = explode("$",$StingName);


WIth these lines:

$ArrayName[0] = "I am worth "
$ArrayName[1] = "80.00"

And the dollar is dollar.



Hope helped you.-bclt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top