("\\") what on earth are these? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

("\\") what on earth are these?

Yeah

17th May 2019, 8:20 PM
BrandnameOra
BrandnameOra - avatar
14 Answers
17th May 2019, 9:11 PM
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 - avatar
+ 21
BrandnameOra I hope, this example will help you! 😉 • https://code.sololearn.com/c17vrZNd1e5t/?ref=apphttps://code.sololearn.com/WgjV487TEMRS/?ref=app [ Edited: ] ➝ String[] split(String regex, int limit); This String split method is used when we want the substrings to be limited — https://beginnersbook.com/2013/12/java-string-split-method-example/ • split("anydelimiter", 3) would return the array of only 3 strings even if the delimiter is present in the string more than 3 times. ➝ If the 'limit is negative' then the returned array would be having as many substrings as possible however when the 'limit is zero' then the returned array would be having all the substrings excluding the trailing empty Strings.
18th May 2019, 8:35 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 20
• Any letter suffixed to \ is treated as an 'escape sequence' by the JVM. • \\ is also an escape sequence and JVM places a single slash (instead of two slashes) in the output. • In writing the regular expressions also, it must be taken care of.
17th May 2019, 11:27 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 8
TheCoder | Hi fellow coders I think you're confusing forward slashes with backslashes.
17th May 2019, 10:40 PM
Sonic
Sonic - avatar
+ 3
"\" is also known as escape sequence character. The character followed by "\" is treated like a special character. For example "\n" means line break. "\r" means carriage return, etc. Similarly, "\" is also used to assign (or print) some special characters. For example you want to output hello \n world Then you can't write System.out.println("hello \n world"); Because it will give output hello world And so, to prevent it, you should write System.out.println("hello \\n world"); NOTE: here the second forward slash between first forward slash and character n is treated special due to first forward slash. And so first forward slash will not be printed, but the second forward slash will get printed.
17th May 2019, 8:32 PM
Chirayu Joshi
Chirayu Joshi - avatar
+ 3
BrandnameOra In your profile section (hit the 👤 icon at the top) you will find those posts under your activity tab. All of your comments are listed there also. The problem with posting in your feed is that most people's feed posts rarely get seen so 🤷‍♂️ Now remember, there is a difference between your personal feed posts and your questions here in the Q&A section. That post that I linked was a personal feed post which, as I said, you can find under your activity tab in your profile. Your Q&A posts you can find by going to the Q&A section and changing the sorting from "hot today" to "my questions". You are using the app right, and not the seriously lacking PC version right? 🤨
18th May 2019, 12:14 AM
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 - avatar
+ 2
It is just another character. The backslash itself is an escape character so it must be escaped by itself to print just one backslash. E.X : System. out. print(" Hi \\ Friends " ); The output will be : Hi \ Friends . If you do like this : System. out. print(" Hi \ Friends " ); The compiler will give you an error telling you that you used an illegal escape character Becuase \ itslelf it's an escape character , if you put it alone it will show you a error , so we use \\ to tell the complier to print backward slash \.
17th May 2019, 8:49 PM
Abdulrahman
Abdulrahman - avatar
+ 2
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 Wholly Molly!!! How did you find it? I'm far from stupid, but I have tried to find my own questions and couldn't find them. Makes this Finlandes (french quote to lift my spirits) a bit sore And I'm not stupid, but it's probably a simple solution that I have not just thought about.
17th May 2019, 9:21 PM
BrandnameOra
BrandnameOra - avatar
+ 2
And I stillhave no idea what this means? String a[]="76.88.".split ("\\.",-1)
18th May 2019, 5:18 AM
BrandnameOra
BrandnameOra - avatar
+ 2
BrandnameOra Do you use Google photos? You can get safe, postable links to individual photos of yours that way. That is what I use myself.
18th May 2019, 11:39 AM
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 - avatar
+ 1
Hey Chirayu Joshi Thanks for your help here. I really appreciate it. I posted the further question in my "what's going on?" question. I still don't know how to find it after I posted it, which makes it impossible to share with you. Can you find it somehow?
17th May 2019, 8:45 PM
BrandnameOra
BrandnameOra - avatar
+ 1
It's so great that you all help me. Although this code line was on the Java challenge questions. And I have no idea what it means. String a[]="76.88.".split ("\\.",-1)
17th May 2019, 8:58 PM
BrandnameOra
BrandnameOra - avatar
+ 1
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 Okay, I knew about the profile section, that I can see it from there. But all the people are posting in there like crazy, so I usually have no chance of looking at my posts afterwards. Which is a shame. And I like to post at the q&a section, but I can't upload a picture there... And like in this post's question, I needed to take a screenshot of the challenge question to copy the code line. Which was a quite a task, I must say. And if I remember correctly, you can not tag anyone to your activity post... Oh, and I'm using the Sololearn application on my Nokia 6 smartphone.
18th May 2019, 5:15 AM
BrandnameOra
BrandnameOra - avatar
0
Okay, it's a good advice
18th May 2019, 2:41 PM
BrandnameOra
BrandnameOra - avatar