Gossamer Forum
Home : Products : DBMan : Customization :

Converting characters

Quote Reply
Converting characters
If someone types a " is there a way to make the script convert it to a ' ?

Maybe:
$rec{'Description'} =~ s/"/'/g;

would that work ?
Quote Reply
Re: Converting characters In reply to
Yep. That'll work.


------------------
JPD





Quote Reply
Re: Converting characters In reply to
Well it didn't work if I put in in the .pl file, but it did work when I put it in the .cgi file and used:

$in{'Description'} =~ s/"/''/g;

BTW, if you look closely, you'll notice I converted a " to 2 single 'quotes'. The output looks just like a real quote" Smile

Problems solved.


[This message has been edited by Katana Man (edited March 14, 1999).]
Quote Reply
Re: Converting characters In reply to
Odd that it didn't work in the html.pl file. But whatever works! Congrats!!!


------------------
JPD





Quote Reply
Re: Converting characters In reply to
i need this feature too,

where EXACTLY do I put it in the script?

Quote Reply
Re: Converting characters In reply to
thanx, now i need to go the other way around.

we are building an events calendar and we need to sort an alphanumeric and display odd dates like "TBA"

so we want data in the database to convert on the fly:

"m-02" becomes "February"

can anyone help?

thanx

Quote Reply
Re: Converting characters In reply to
I'm not sure if I'm understanding you correctly, but if I am, you can make conversions in html.pl, sub html_record before the info is printed.

Just after

%rec = @_;

add your conversions like:

$rec{'Date'} =~ s/m-02/February/g;

The syntax is
s/[part you want replaced]/[what you want to replace it with]/g;



------------------
JPD





Quote Reply
Re: Converting characters In reply to
It would go in sub add_record, just before

$status = &validate_record;



------------------
JPD