How to print the " character without the backslash

Hi, I have this basic question of how to print the character " without the backslash. I'm trying to print html code, so i need " a lot. giveHtml (Leaf (a,(b,c))) = "" Can anybody give me a light here? Many thx, Nuno Santos

Hi
I have this basic question of how to print the character " without the backslash.
I'm trying to print html code, so i need " a lot.
giveHtml (Leaf (a,(b,c))) = ""
Can anybody give me a light here? Yes, use the fact that HTML (and Javascript) both allow either " or ' as their string character.
giveHtml (Leaf (a,(b,c))) = "<frame src='' name='" ++ [a] ++ "' scrolling='No' noresize='noresize' id='" ++ [a] ++ "' title='" ++ [a] ++ "' />"
Less escape characters all round :) You can even (if you wish) write a singleToDouble function that replaced all ' with ", but its not necessary when generating HTML. Thanks Neil

Nuno Santos wrote:
Hi,
I have this basic question of how to print the character " without the backslash.
I'm trying to print html code, so i need " a lot.
giveHtml (Leaf (a,(b,c))) = ""
Can anybody give me a light here?
One way would be to define a helper function to write an opening tag given the tag name and a list of (var,value) pairs: tag :: String -> [(String,String)] -> String tag t ps = "<" ++ t ++ " " ++ concatMap (\(var, value) -> var ++ "=\"" ++ value ++ "\" ") ps ++ ">" then your code would become escape free: giveHtml (Leaf (a,(b,c))) = tag "frame" [ ("src", "") , ("name", [a]) , ("scrolling", "No") , ("noresize", "noresize") , ("id", [a]) , ("title", [a]) ] Regards, Brian. -- Logic empowers us and Love gives us purpose. Yet still phantoms restless for eras long past, congealed in the present in unthought forms, strive mightily unseen to destroy us. http://www.metamilk.com
participants (3)
-
Brian Hulley
-
Neil Mitchell
-
Nuno Santos