All pastes #939686 Raw Edit

Mine

public text v1 · immutable
·published 2008-03-12 14:33 UTC
rendered paste body
<edge`logansama> how would i quote out System.out.println ("A leaning toothpick sum: "\+\=\\" but "/&\is/\".");
<edge`logansama> :|
* Quits: Ethereal^work (Ethereal_w@IDoNotExist.users.quakenet.org) (Ping timeout)
* Quits: StM (~StM@JMB.users.quakenet.org) (Ping timeout)
* Joins: Ethereal^ (Ethereal@IDoNotExist.users.quakenet.org)
* Joins: Ethereal^work (Ethereal_w@a88-115-37-233.elisa-laajakaista.fi)
<@Fx21> huh?
* Quits: Ethereal (Ethereal@IDoNotExist.users.quakenet.org) (Read error: Connection reset by peer)
* Quits: Ethereal^work (Ethereal_w@a88-115-37-233.elisa-laajakaista.fi) (Registered)
* Joins: Ethereal^work (Ethereal_w@IDoNotExist.users.quakenet.org)
<edge`logansama> basically
<edge`logansama> i got to do this assigment
<edge`logansama> say i have a string
<edge`logansama> System.out.println ("She said \"I'm flying tonight\", then left for Jakarta!");
* Joins: StM (~StM@84.243.238.115)
<edge`logansama> to use a quote i would put a backslash before it
<edge`logansama> so i wouldnt get an error
<edge`logansama> but what happens if i already have backslashes in the string
* Quits: echello (~tsogna@140.h.011.mel.iprimus.net.au) (Signed off)
<Olafski> you should escape those as well
<edge`logansama> how do i do it ?
<Olafski> \\ :)
<edge`logansama> i dont have a bleeding clue
<edge`logansama>  ("A leaning toothpick sum: "\+\=\\" but "/&\is/\".");
<edge`logansama> for that ^
<edge`logansama> :/
* Joins: IrM00NSAe (heller@ist.ein.fan.von.gnx-network.de)
<Olafski> you escape backslashes using a backslash
<edge`logansama> so how would it look
<wda> so you just add another backslash?
<edge`logansama> i did 
<edge`logansama> but it didnt work
<wda> no, im not saying thats the answer
<wda> im trying to understand this as well :)
<edge`logansama> :)
<wda> you add the same amount of backslashes to cancel out the previous backslashes?
* Quits: teppi|work (~sl@n074-003.dsl.kunde.inter.net) (Signed off)
<edge`logansama> hmm 
<edge`logansama> so how would it look
<edge`logansama>  ("A leaning toothpick sum: \\\\"\+\=\\" but \\\\"/&\is/\".");
<edge`logansama> ?
<wda> looks a bit odd to be honest
* Parts: IrM00NSAe (heller@ist.ein.fan.von.gnx-network.de)
<edge`logansama> yeh 
<wda> but then again, im as good at coding as g.w. bush is att running a country.
<edge`logansama> :/
<wda> s/att/at
<edge`logansama> im so confused
<wda> have you tried running it like that?
<wda> the last one you typed...that looks odd
<edge`logansama> how u mean
<edge`logansama> yeh it did
<MasseR> \\ is \
<MasseR> \\\\ is \\
<edge`logansama> MasseR
<edge`logansama>  ("A leaning toothpick sum: "\+\=\\" but "/&\is/\".");
<wda> so -> "\+\=\\" would be "\+\=\" `?
<edge`logansama> how would i get it to print A learning toothpick sum: "\+\=\\" but  "/&\is/\".
<@Fx21> don't give him the full answer
<edge`logansama> lol 
<wda> hehe
<@Fx21> he'll just copy it and not learn anything
<edge`logansama> so many people here know :p
<Olafski> come on edge`logansama 
<edge`logansama> im trying to work it out
<Olafski> we've basically told you how to do it
<wda> hmm
<edge`logansama> you really havnt 
<edge`logansama> because what i thought it was 
<edge`logansama> didnt work
<Olafski> sure we did
<wda> edge`logansama what happens when you just run it the way you had it from the beginning?
<Olafski> escape backslashes by adding another backslash
<edge`logansama> wda: error
<wda> ok
<edge`logansama> wont even compile
<wda> what i understand from what Olafski just typed
<edge`logansama> to escape a backslash u use another backslash
<wda> he means that you can either evade that problem by adding 1 backslash
<edge`logansama> yeh where to tho 
<wda> or he means you need 1 backslash for each other backslash you want to escape
<wda> there cant be that many places to try it
<Olafski> wda: for every \ you want to display, you need to put \\ in the string
<edge`logansama> so "\+\=\\" but "/&\is/\" would look like    \\\"\+\=\\" but \\"/&\is/\"
<wda> i'd try it if I had the whole code 
<wda> Olafski ohh, then i misunderstood
<Olafski> wtf edge`logansama :s
<edge`logansama> IM NEW TO THIS 
<edge`logansama> I DONT HAVE A CLUE
<edge`logansama> geeze
<edge`logansama> i do php 
<Olafski> ah okay
<edge`logansama> i dont do bloody java
<Olafski> that's all the help you got from me then
<edge`logansama> stupid uni 
<Olafski> no need to get like that about it :)
<edge`logansama> :/
<edge`logansama> i wasnt getting "like" about it
<Olafski> (and in php you need to escape your quotes as well)
<edge`logansama> yes
<Xabster> if you haven't heard of escape characters, you didnt follow your courses properly
<edge`logansama> erm
<edge`logansama> ive followed all my courses properly
<edge`logansama> ididot
<Olafski> yeah that's a sure way to get help from people :P
<edge`logansama> its just irritating 
<edge`logansama> when theres people sitting here 
<edge`logansama> knowing the answer 
<wda> edge`logansama patience is a virtue :P
<Xabster> lol
<@Fx21> :)
<wda> edge`logansama are you pressured by time?
<Olafski> pressured by bad planning :P
<Xabster> and attitude
<@Fx21> edge`logansama, maybe you could try to write increasingly difficult strings and work your way to the solution that way
<edge`logansama> <wda> edge`logansama are you pressured by time?
<edge`logansama> yes
<edge`logansama> this is the final question
<edge`logansama> then i can hand it in
<wda> but is there a deadline?
<edge`logansama> 2pm
<edge`logansama> but i need to drive to scotland 
<edge`logansama> from bristol 
<edge`logansama> :(
<wda> to hand it in?
<edge`logansama> no
<wda> oh
<edge`logansama> to go home and see my family
<wda> id try to help you some more, but im as new to Java as you are...or even newer, i just started coding and began with Java.
<Xabster> a \ has a meaning when put in a string, not like a b c d e f etc.
* deeage is now known as Deeage
<Xabster> there are other "special" characters
<Xabster> \ escapes these characters and it also escapes itself
<wda> hehe
<wda> then what is its use? if not only to escape
<wda> or maybe that's its only use :S
<Xabster> it's only to escape
<wda> ok
<Xabster> fx \n which you probably know is an endline character
<Xabster> \r\n is carriage return, endline
<wda> but does "\+\ = \\" count as 4 backslashes or only as 2?
<Xabster> What do you mean with count?
<Xabster> -sysout "\+\ = \\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal escape character
<+Suzy-chan> sysout("\+\ = \\"
<+Suzy-chan>          ^
<wda> :o
<Xabster> \+ has no special meaning, therefor error
<Xabster> + characters does not need escaping, \ does
<wda> ahh, i see
<wda> i think its getting clearer...i have to type it to see if im right or just wishing im right.
<edge`logansama> hmmm
<morkar> -sysout "\\o/"
<+Suzy-chan> \o/
<Xabster> you can do like I did and test it with the bot
<wda> -sysout "/&\is/\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal escape character
<+Suzy-chan> sysout("/&\is/\"
<+Suzy-chan>            ^
<edge`logansama> -sysout "\\+\=\\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal escape character
<+Suzy-chan> sysout("\\+\=\\"
<+Suzy-chan>             ^
<edge`logansama> -sysout \"\+\=\\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92
<+Suzy-chan> sysout(\"\+\=\\"
<+Suzy-chan>        ^
<wda> hehe
<edge`logansama> :/
<morkar> lol
<Xabster> edge`logansama, you escaped the first backslash
<Xabster> continue to escape the other
<Xabster> (your first attempt, 2nd is no good)
<edge`logansama> -sysout \"\+\\=\\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92
<+Suzy-chan> sysout(\"\+\\=\\"
<+Suzy-chan>        ^
<edge`logansama> -sysout \\"\+\=\\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92
<+Suzy-chan> sysout(\\"\+\=\\"
<+Suzy-chan>        ^
<morkar> CLOSE
<morkar> naah gettin colder
<edge`logansama> -sysout \\"\+\\=\\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92
<+Suzy-chan> sysout(\\"\+\\=\\"
<+Suzy-chan>        ^
<edge`logansama> WOADJIAWODJAWD
<wda> hehe
<wda> calm down :D
<edge`logansama> >_<
<Xabster> Okay, listen
<Xabster> let's start with ""
<Xabster> that's a string
<Xabster> now we put stuff into it
<edge`logansama> uhuh
<Xabster> what's the first thing we want to put in it?
<Olafski> :P
<Xabster> a backslash, right?
<edge`logansama> ("A leaning toothpick sum: "\\+\=\\" but "/&\is/\".");
<edge`logansama> thats my string
<Xabster> small steps, bro
<edge`logansama> ok
<Xabster> the first you want to output is a backslash
<edge`logansama> ok
<Xabster> and i'm telling you that backslash is the escape character which escapes other characters and also itself
<Xabster> that means we need to to \ (to start escaping) and then \ to tell it which character to escape
<Xabster> that's \\
<Xabster> -sysout "\\"
<+Suzy-chan> \
<Xabster> now what? a +?
<edge`logansama> its nothing
<edge`logansama> i think
<edge`logansama> Write a Java program called Backslash in package assignment1 which outputs this string:
<Xabster> sorry what?
<edge`logansama> A leaning toothpick sum: "\+\=\\" but "/&\is/\".
<edge`logansama> thats what i have to do 
<edge`logansama> so i guess +
<Xabster> alrighty
<edge`logansama> is just text
<Xabster> [11:35:20] <Xabster> + characters does not need escaping, \ does
<Xabster> yes, it is
<Xabster> -sysout "\\+
<+Suzy-chan> execPlugin/Exec.java:42: unclosed string literal
<+Suzy-chan> sysout("\\+
<+Suzy-chan>        ^
<Xabster> -sysout "\\+"
<+Suzy-chan> \+
<Xabster> my bad
<Xabster> now another backslash - same procedure as before - you do this one
<wda> -sysout "\\+\\=\\\\\"
<+Suzy-chan> execPlugin/Exec.java:42: unclosed string literal
<+Suzy-chan> sysout("\\+\\=\\\\\"
<+Suzy-chan>        ^
<Xabster> 1 too many \'s at the end
<wda> -sysout "\\+\\=\\\\"
<+Suzy-chan> \+\=\\
<Xabster> you're escaping the ending of the string
<edge`logansama> righty thats all i wanted to know
<edge`logansama> i was doign it at the front 
<Xabster> yes, now we got the first part right (except what we need to enclose it in "")
<edge`logansama> and it was so irritating
<edge`logansama> Xabster: yes 
<Xabster> "-characters also need escaping
* Quits: |arda| (~kvirc@p548654A8.dip.t-dialin.net) (Read error: Operation timed out)
* Joins: star_gazbpmi (~Mcbride@port12.ds1-ro.adsl.cybercity.dk)
<morkar> well he gotta \ alot in that sentence :p
<edge`logansama> :)
<wda> -sysout \"\\+\\=\\\\"\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92
<+Suzy-chan> sysout(\"\\+\\=\\\\"\"
<+Suzy-chan>        ^
<Xabster> the first and last "-character can not be escaped
<Xabster> they mean the start and end of the string
<wda> ok
<edge`logansama> -sysut \"\\+\\=\\\\
<edge`logansama> -sysout \"\\+\\=\\\\
<+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92
<+Suzy-chan> sysout(\"\\+\\=\\\\
<+Suzy-chan>        ^
<Xabster> you need to start and end all -sysout commands (or string declarations with "-character)
* Joins: teppi|work (~sl@n074-003.dsl.kunde.inter.net)
<wda> -sysout \"\\+\\=\\\\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92
<+Suzy-chan> sysout(\"\\+\\=\\\\"
<+Suzy-chan>        ^
* Deeage is now known as deeage
<Woflborg> you're breaking form
<wda> -sysout "\\+\\=\\\\"
<+Suzy-chan> \+\=\\
<Xabster> -sysout "           put stuff here             "
<+Suzy-chan>            put stuff here             
<Xabster> -sysout "           \\+\\=\\\\             "
<+Suzy-chan>            \+\=\\             
* Joins: sco_uni (~sco_uni@holodoc.fim.uni-passau.de)
<Xabster> -sysout "      \"     \\+\\=\\\\     \"        "
<+Suzy-chan>       "     \+\=\\     "        
<Woflborg> i thought all teaching in irc should be done in the goold old time proven "sarcasm and ridicule" format 
<Woflborg> -o
* Parts: star_gazbpmi (~Mcbride@port12.ds1-ro.adsl.cybercity.dk)
<Woflborg> -l
<Xabster> read up, Woflborg
<edge`logansama> hmm
<Xabster> we did that part :)
<edge`logansama> im completely lost
<Woflborg> oh
<Woflborg> dont mind me then
<wda> edge`logansama why? Xabster is explaining it quite nicely :)
<edge`logansama> the put stuff here part
<wda> atleast the first part of that backslash-string you have
<edge`logansama> confused me
<wda> put stuff here = filling your string with whatever you want (i guess)
<Xabster> already, look here, edge`logansama:
<Xabster> [11:46:29] <Xabster> -sysout "      \"     \\+\\=\\\\     \"        "
<Xabster> [11:46:31] <+Suzy-chan>       "     \+\=\\     "        
<Xabster> I over-spaced it
<Xabster> start with " without any \ stuff
<Xabster> and end with it also
<edge`logansama> ah
<edge`logansama> i got that part
<Xabster> " = start or end of string-declaration
<Xabster> \ = next character will be treated not-normal
<Xabster> \" = put a "-character in the string
<edge`logansama> ok
<Xabster> \\ = put a \-character in the string
<Xabster> \n = put a new-line character in the string
<edge`logansama> im working on "/&\is/\"
<edge`logansama> now
<Woflborg> your teacher probably wants you to use nonabnormal characters ;) 
<Xabster> Okay, i gave you a small table of stuff that needs to be escaped, now identify which characters needs escaping in that text you just pasted, edge`logansama
<Woflborg> and i've heard that bringing an apple can help
<edge`logansama> -sysout \"/&\\is/\\\"
<+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92
<+Suzy-chan> sysout(\"/&\\is/\\\"
<+Suzy-chan>        ^
<Xabster> damn dude
<Xabster> first rule, all strings START with " and END with "
<morkar> nearly :p
<Xabster> what you just tried starts with \ and ends with "
<edge`logansama> no
<edge`logansama> but it actually worked
<Woflborg> yes
<Woflborg> no
<edge`logansama> ?
<morkar> maybe
<edge`logansama> it did
<edge`logansama> run-single:
<edge`logansama> A leaning toothpick sum:  "\+\=\\" but "/&\is/\"
<edge`logansama> BUILD SUCCESSFUL (total time: 0 seconds)
<Woflborg> if i were you 
<Woflborg> i'd bring an apple
<Xabster> yay for edge`logansama
<edge`logansama> \o/
<edge`logansama> thanks guys
<edge`logansama> sorry to be such a bum
<Woflborg> or other fruit based solution 
<Olafski> cya
<edge`logansama> cheers 
<Xabster> mojn
<edge`logansama> what a gay problem 
<edge`logansama> :(
<Olafski> how mature :P university for real?
<Xabster> I'm 100% sure you teacher or lecturer would not pose such a problem without telling you about escape characters and/or give me you a chapter to read
<edge`logansama> i dont have the book 
<edge`logansama> :(
<edge`logansama> no money
<Woflborg> Xabster: that would be hell. Professors popping in here, telling us that there are probably students incoming, read these chapters.. 
<Xabster> i see
<Xabster> heh
<Xabster> i'd really laugh my ass off if that ever happened
<edge`logansama> then you would be a complete nerd
<edge`logansama> and care to much
<Woflborg> but we are 
<Xabster> and we do
<edge`logansama> i know
<edge`logansama> sad innit
* Xabster highfives Woflborg
* Parts: edge`logansama (logan@81.19.220.25)
<Woflborg> actually
<Woflborg> it grows on you
<Olafski> you spent that much time helping him
<Olafski> and he just insults you and leaves?
<morkar> \\
* Joins: It_Just_Love (~mit@89.201.75.138)
-
edge`logansama is logan@81.19.220.25 * BNC from #X3-Servers www.X3-Servers.co.uk
edge`logansama on @#edge @#cymru +#rastaclan #chelseafc +#wotr @#bodybuilding.uk +#css @#team-wales.cs 
edge`logansama using *.quakenet.org QuakeNet IRC Server
edge`logansama is authed as maxs
edge`logansama End of /WHOIS list.
-
<Xabster> he's a counterstriker i guess
<Olafski> suppose so yeah
<Olafski> "omg I follow my courses properly"
<Olafski> "however I don't have a book"