Im trying to do an if, else loop to perform a function based on weather or not a certain field in a database contains a particular character and its giving me greif, heres what I have....
one field in my returned aray contains a variable string ($isbn) that may or may not contain the letter u or n at the end.
if ($isbn == "%n") {
PRINT "foo"
} ELSEIF ($isbn == "%u") {
PRINT "bar"
} ELSE {
PRINT "something"
}
I know this is wrong, how can I process the string to remove all but the last character to make a new variable ($stripped)
IE:
if ($stripped == "n") {
PRINT "foo"
} ELSEIF ($stripped == "u") {
PRINT "bar"
} ELSE {
PRINT "something"
}
or failing that how can I wildcard the condition (the string will always contain just numbers, (perhaps) hyphens and sometimes the letter u or n at the end -it could in rare occasions be blank-)
1222222222
1222222222u
1-2222-222-22
1-2222-222-22u
1-2222-222-22n
the only conditions I care about is if the string contains a u or n at the end.
many thanks, im sure this is a no brainer, but I just cant seem to find the answer.