Remove Junk/Special Chars in a String - Java Interview Questions -2

  Рет қаралды 112,921

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

Пікірлер: 52
@marlynj7930
@marlynj7930 3 жыл бұрын
Naveen--You need not say during the end of the video---subscibe,share,like!!!Needless to say that!!We have all loved your videos and will be loving your videos--When we love then subscription,liking,sharing is unimaginable!Thanks Naveen!!!
@lisazhou7776
@lisazhou7776 5 жыл бұрын
Naveen, I like your videos very much. Your explanation is amazing, simple and clear. Thank you very much!
@sowjanyadarbha8403
@sowjanyadarbha8403 4 жыл бұрын
Thanq so much Naveen for the clear explanation. Your videos brought me confidence in Java
@sachin21890
@sachin21890 6 жыл бұрын
Hi Naveen, How are we able to change the original values of strings 's' and 's1' here by using replaceAll() function ? aren't they immutable? I'm confused here
@ravijharox01
@ravijharox01 6 жыл бұрын
Run, below code. You will be able to find out the difference. String str = "!@#$%^&*()_+}{|?>::
@coolsaty007
@coolsaty007 6 жыл бұрын
If you observe carefully what he has done is "s=s.replaceAll()". which means he is assigning the new value to s. Now "s" is pointing to a new string object.
@mdrajeshwar1
@mdrajeshwar1 3 жыл бұрын
@@ravijharox01 I am trying with this solution String s = "拉杰什瓦尔 Welcome 拉杰什瓦尔 220120"; // regular expression [^a-zA-Z0-9] String Removed =s.replaceAll("[^a-zA-Z0-9]", " "); System.out.println(Removed); Out put is Welcome 220120 perfectly working only we have assigned to a new string variable
@ritumehta1280
@ritumehta1280 6 жыл бұрын
Hi Naveen, you are doing a great job. All of your videos are really helpful. The only thing if you could is please increase the font of the text for your upcoming videos! Thanks! :)
@pratimadaswante4117
@pratimadaswante4117 3 жыл бұрын
Hi sir in this program when I have enter backslash(\) then that slash remains there instead of removing it🙄
@shafiqurrahman5809
@shafiqurrahman5809 5 жыл бұрын
Hi, Naveen if String is immutable how are we able to change it? Please clarify why in this case String is mutable?
@vanajabethina5991
@vanajabethina5991 5 жыл бұрын
Me as same doubt na
@selectiveeagle4040
@selectiveeagle4040 5 жыл бұрын
same here
@shilpajain4061
@shilpajain4061 3 жыл бұрын
HI , Please help me fix the below error: Error occurred during initialization of boot layer java.lang.module.FindException: Error reading module: C:\Users\shilpa.jain\eclipse-workspace\OOPS\bin Caused by: java.lang.module.InvalidModuleDescriptorException: MyCar.class found in top-level directory
@mayankbhatkar4487
@mayankbhatkar4487 3 жыл бұрын
If we want to allow Japanese text and also restrict special character, how can we achieve that?
@nikhiltillu6201
@nikhiltillu6201 6 жыл бұрын
Hi Naveen, You said not to use Ascii codes, can you let me know the reason for it ? The concept to use a regex was good, but its removing the space too. With the help of ascii values we can include the spaces too. int len = s.length(); String n = ""; char ch; int ascii; for (int i = 0; i < len; i++) { ch = s.charAt(i); ascii = (int)ch; if((ascii >= 65 && ascii = 97 && ascii
@croonmelody7097
@croonmelody7097 2 жыл бұрын
use regex alongwith space like [^ a-zA-Z0-9]
@passgreenearth
@passgreenearth 3 жыл бұрын
Hi Naveen, Chinese character is not saving in my eclipse, please help.
@chanduyagnesh5501
@chanduyagnesh5501 Жыл бұрын
if we donot use inbuilt methods then how to do that also explain sir
@ujjwalverma7787
@ujjwalverma7787 6 жыл бұрын
sir, please help me i really confuse between them what is the difference between the "array.length and array.length()" some time array.length will work and some time array.length() will work. is there is any rules for is for using it? with String arr.length() will work but when we use an integer type, its work with array.length.
@vikaskumar-qr5tj
@vikaskumar-qr5tj 6 жыл бұрын
length() is method present in object class to calculate length of string but length is a variable which returns size of array.....
@achintyasett9621
@achintyasett9621 4 жыл бұрын
Hi Naveen, Thanks for this helpful video. I would like to add that a shorter regex [^\w\d] will also work in the given scenario.
@Deepak-wm4qg
@Deepak-wm4qg 3 жыл бұрын
Bro, ewr screen is not visible in 360p also Thts y, low traffic in ewr channel, pls remove that side bar, so that it could be seen clearly
@nitingupta82
@nitingupta82 5 жыл бұрын
Awesome!! Thank You Very Much!!
@chetanachavan6116
@chetanachavan6116 3 ай бұрын
str=str.replaceAll("[^ a-zA-Z0-9]",""); by using this we can keep space as it is in between 2 words. but what if more than space 1 space I want to remove from 2 words.
@salehashamim7803
@salehashamim7803 4 жыл бұрын
Please someone write the particular replaceAll line. It is not visible on my mobile.
@kapilrana2361
@kapilrana2361 5 жыл бұрын
Hi Naveen, Nice explanation. One query, If the string is immutable then why replace method is there. I can change the value using the replace method. public class RemoveJunkCharacter { public static String s = "kapil"; public static void main(String args[]) { s= s.replace('l', 'i'); s=s.replace('p', 'i'); System.out.println(s); } } Output: kaiii. Please suggest, I think I am getting something wrong.
@bharathkoneru4008
@bharathkoneru4008 5 жыл бұрын
For every operation performed on the string, a new String object is created with those changes. Here, first you declared String s='kapil' string var s is referring to String object which has value 'kapil' Now on using replace method on this String obj. a new string object is created. s.replace('l','i'); Here you are assigning the entire right hand side expression to the string variable s=s.replace('l','i') which was initially referring to string obj kapil. On this assignment this s starts referring to this newly created object.
@ajayparjapati0902
@ajayparjapati0902 3 жыл бұрын
sir how can print the string and also print the chrctr int last like= hello@#@#@ like this
@anithas5014
@anithas5014 5 жыл бұрын
Hi Naveen I am getting the output as ^Testing123 Console output is generating with exclude symbol
@sureshm2047
@sureshm2047 5 жыл бұрын
Hi Naveen wanted to join online training from you!! Is there any chance for us?
@raghureddy5712
@raghureddy5712 7 жыл бұрын
thank you Naveen bro and How to give spaces?
@ravijharox01
@ravijharox01 6 жыл бұрын
str = str.replaceAll("[^a-zA-Z0-9\\s]", "");
@nexar2811
@nexar2811 3 жыл бұрын
Thank You Boss
@kamleshlohar
@kamleshlohar 6 жыл бұрын
thanks for better concepts
@azimadayani2379
@azimadayani2379 3 жыл бұрын
Didn’t get replace all option
@prabeshkumarbhagat2989
@prabeshkumarbhagat2989 6 жыл бұрын
Thanks Naveen.
@maarcoo97
@maarcoo97 5 жыл бұрын
Thanks!
@sridevireddy1371
@sridevireddy1371 7 жыл бұрын
Thank you Naveen
@oopsididitagain8572
@oopsididitagain8572 5 жыл бұрын
Thank you
@deepakjava3506
@deepakjava3506 4 жыл бұрын
thank you so much.
@ramanujamsunkari946
@ramanujamsunkari946 6 жыл бұрын
Please increase font size.... It is not clear to watchable
@samalmaleesha283
@samalmaleesha283 4 жыл бұрын
lifesaver
@umeshnaik844
@umeshnaik844 6 жыл бұрын
how to retain space
@mariabajwa8632
@mariabajwa8632 6 жыл бұрын
thank u
@VandanaYadav-yp9zv
@VandanaYadav-yp9zv 6 жыл бұрын
Hi Naveen FIrst of all Thanks for all the great work you are doing . one observation i have regarding replaceALL() method is that String samplestring = "^^^^^^van^^^^^^^^^^yad^^^^^^^^^^^^^^^^^^^^"; samplestring = samplestring.replaceAll("[^a-zA-z]", ""); System.out.println("samplestring after removing junk:"+samplestring); It dosent replace ^ sign from the sample string.
@ravijharox01
@ravijharox01 6 жыл бұрын
String samplestring = "^^^^^^van^^^^^^^^^^yad^^^^^^^^^^^^^^^^^^^^"; samplestring = samplestring.replaceAll("[^a-zA-Z]", ""); System.out.println("samplestring after removing junk:" + samplestring); Try above code, it will work. You used 'a-zA-z' instead of 'a-zA-Z'
@VandanaYadav-yp9zv
@VandanaYadav-yp9zv 6 жыл бұрын
Thanks Ravi! it worked now!
@salehashamim7803
@salehashamim7803 3 жыл бұрын
Java code to remove double quotes string in excel.
@manikandand2541
@manikandand2541 5 жыл бұрын
wowwwwwww
@mdsabirali_Keep_learning
@mdsabirali_Keep_learning 15 күн бұрын
⭐⭐⭐⭐⭐
@MBindu-kc2nj
@MBindu-kc2nj 2 жыл бұрын
Thank You
How to Reverse an Integer - Java Interview Question -3
11:35
Naveen AutomationLabs
Рет қаралды 111 М.
How to find Missing Number In Array - Java Interview Question -4
12:40
Naveen AutomationLabs
Рет қаралды 104 М.
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН
Nexus CMS User Learning Series: Requesting More Content
16:00
Difference between Interface and Absract Class
30:52
Naveen AutomationLabs
Рет қаралды 183 М.
How to Find Duplicates Elements in Java Array? - Java Interview Questions -5
29:34
Some cool facts about Null in Java || Important to know
17:33
Naveen AutomationLabs
Рет қаралды 17 М.
Can we overload a main() method in Java? || Java Interview Question
13:24
Naveen AutomationLabs
Рет қаралды 61 М.
Find Duplicate Elements in An Array || Important Java Interview Questions
22:36
Naveen AutomationLabs
Рет қаралды 53 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23