String Manipulation in Java - Interview questions - Part -7

  Рет қаралды 113,076

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

Пікірлер: 69
@rajatgoyal7155
@rajatgoyal7155 6 жыл бұрын
I have purchased 2 courses to understand Selenium and Java and i spent almost 13k rupees, they didn't tell me so elaborately even after charging so much. your tutorials are really helpful, one can easily understand and learn, moreover they can get enough confidence in few days to crack any MNC interview. Great job Naveen. Keep it up. please keep these tutorials free in future as well.
@FitHighFive
@FitHighFive 3 жыл бұрын
Thank you so much Naveen for this video, really got clear picture on String methods.
@subhashpatil4286
@subhashpatil4286 5 жыл бұрын
Sir, no words for your explanation. You are simply born to teach!!!!
@yolwasmirzat
@yolwasmirzat 6 жыл бұрын
This helps me a lot , thank you so much , this makes my java basic is so clear , and recently have interview , your interview section also helps me a lot .
@aparnabhosale7483
@aparnabhosale7483 10 ай бұрын
so beautifuuly explained..thnku sir
@harishpandey9003
@harishpandey9003 6 жыл бұрын
very helpful, I used to watch your video, The way you explaining the things is very easy to understand.
@lisazhou7776
@lisazhou7776 5 жыл бұрын
very good and very helpful. Thanks a lot Naveen!
@shilpathada5832
@shilpathada5832 3 жыл бұрын
String str = "The rains have started here selenium"; System.out.println(str.indexOf(('s'), str.indexOf('s') + str.indexOf('s')+1));//3rd occurrence of 's'
@MarkGavrilov
@MarkGavrilov 2 жыл бұрын
This one works as well: System.out.println(str.indexOf('s',str.indexOf('s')+str.indexOf('s',+1)));
@softwaretestingatoz3160
@softwaretestingatoz3160 Жыл бұрын
System.out.println(str.indexOf('s',str.indexOf('s' +1)+1)); its this correct way to find 3rd veriable?
@shubhtiwari4682
@shubhtiwari4682 5 жыл бұрын
occurrence of third 's' System.out.println(str.indexOf('s', str.indexOf('s', str.indexOf('s')+1)+1));
@bharatvarshney2666
@bharatvarshney2666 6 жыл бұрын
Thanks for your efforts Naveen Sir, it is really worthful for me to clear concept in java
@tikarobinson9335
@tikarobinson9335 5 жыл бұрын
Thank you so much, this helps alot.
@navathutejomai1038
@navathutejomai1038 2 жыл бұрын
Sir I got a doubt as string is immutable how can we concatenate and assign to same string, just read on net that a new string is created and it reference is set to the object reference.
@ParthKandpal
@ParthKandpal 5 жыл бұрын
Hi Naveen, Please find below the code for 3rd occurence of s String str="The Rains have started here selenium"; System.out.println(str.indexOf("s", str.indexOf("s")+str.indexOf("s")+1)); output will be -->28 Thanks :)
@softwaretestingatoz3160
@softwaretestingatoz3160 Жыл бұрын
System.out.println(str.indexOf('s',str.indexOf('s' +1)+1)); its this correct way to find 3rd veriable?
@saig3660
@saig3660 2 жыл бұрын
Awesome lecture...
@deepikavijay3846
@deepikavijay3846 5 жыл бұрын
Hi Naveen. Nice video. Could you please prepare a video for Regex ?
@venkateshandea1767
@venkateshandea1767 6 жыл бұрын
Hey Naveen anna you are doing great job I'm finding these days that everyone suggesting ur videos to others in selenium groups and everywhere though ur channel is quite is new u r reaching aspirants very quickly ....and help me with this I'm not able to print 3rd occurance of 's'...I did this System.out.println(s.indexOf('s', s.indexOf('s', s.indexOf('s')+1))); ...
@lekhraj4395
@lekhraj4395 6 жыл бұрын
starting index should be 15; String str = "The rains have started here in selenium"; System.out.println(str.length()); System.out.println(str.charAt(5)); System.out.println(str.indexOf("s")); System.out.println(str.indexOf("s", str.indexOf("s")+1)); System.out.println(str.indexOf("s", str.indexOf("s")+15));
@saranyasanapala1049
@saranyasanapala1049 6 жыл бұрын
If any one done this plz post here
@borgjoseph
@borgjoseph 6 жыл бұрын
public static void main(String[] args) { FindNthIndexOfACharacter('s', "The rains have started here in selenium", 3); } private static void FindNthIndexOfACharacter(char c, String str, int position) { int count = 0; //str = str.replaceAll("\\s", ""); -- uncomment this line if you want to remove spaces for (int i = 0; i < str.length(); i++) { if (str.toUpperCase().charAt(i) == Character.toUpperCase(c)) { count += 1; if (count == position) { System.out.println(i); break; } } }
@sumirozario904
@sumirozario904 5 жыл бұрын
@@saranyasanapala1049 String str ="The rain has started here for some reason"; System.out.println("The location of second occurence of 's' is :" +str.indexOf('s',str.indexOf('s')+1)); System.out.println("The location of third occurence of 's' is :" +str.lastIndexOf('s', str.lastIndexOf('s')-1)); System.out.println("The location of last occurence of 's' is :" +str.lastIndexOf('s'));
@KingRetrixx
@KingRetrixx 5 жыл бұрын
System.out.println(str.indexOf('s', str.indexOf('s',str.indexOf('s')+1)));
@kishoruprade
@kishoruprade 3 жыл бұрын
Nice video..
@devarapallirohini5369
@devarapallirohini5369 6 жыл бұрын
Hi Naveen, i am unable to print the 3rd occurance in the sentence, tried it in many ways. Google is having some complex code. Could you please provide your inputs.
@devarapallirohini5369
@devarapallirohini5369 6 жыл бұрын
Thanks
@srihari4827
@srihari4827 6 жыл бұрын
I think we can use OrdinalIndexOf in StringUtils
@nandhanamtalkies2332
@nandhanamtalkies2332 5 жыл бұрын
str.indexOf(‘s’, str.indexOf(‘s’, str.indexOf(‘s’, str.indexOf(‘s’)+1)+1)
@kalyanitarawate1141
@kalyanitarawate1141 2 жыл бұрын
The letters are not clearly visible. Explanation is good.
@Ruchi569
@Ruchi569 5 жыл бұрын
Thanks a lot ! Please do a few programs on Collections...
@DaddyPrincess
@DaddyPrincess 5 жыл бұрын
Really awesome tutorial!
@manju1ification
@manju1ification 5 жыл бұрын
Hi Naveen can you add program to find (first and last)non repeated character in a string
@shankarpk89
@shankarpk89 5 жыл бұрын
package javaPrograms; public class NonRepeatingChar { public static void main(String[] args) { String str = "INDIAFORINDIANSFIRST"; System.out.println("FIRST NON REPEATING CHARACTER IS : " + findFirstNonRepeatingCharacter(str)); System.out.println("LAST NON REPEATING CHARACTER IS : " + findLastNonRepeatingCharacter (str)); } public static char findFirstNonRepeatingCharacter(String str) { str = str.toUpperCase(); char chr = 0; for (int i = 0; i < str.length(); i++) { if (!str.substring(i + 1).contains(Character.toString((str.charAt(i))))) { chr = str.charAt(i); break; } } return chr; } public static char findLastNonRepeatingCharacter(String str) { str = str.toUpperCase(); char chr = 0; for (int i = 0; i < str.length(); i++) { if (!str.substring(0, str.length() - i - 1) .contains(Character.toString((str.charAt(str.length() - i - 1))))) { chr = str.charAt(str.length() - i - 1); break; } } return chr; } }
@khushbooshah7441
@khushbooshah7441 2 жыл бұрын
one doubt Output2.IndexOf("W",Output2.IndexOf("W")+1) how will i get the index of 3rd occruence of W in string
@surekapandian1075
@surekapandian1075 3 жыл бұрын
Telegram link is expired... Is there new link?
@arabindamohanty2190
@arabindamohanty2190 5 жыл бұрын
Thanks a lot
@buvanapandu
@buvanapandu 6 жыл бұрын
System.out.println(str.indexOf('s',str.indexOf('s' +1)+1)); //3rd occurrence of s or any occurrence
@buvanapandu
@buvanapandu 6 жыл бұрын
is it correct? im getting the correct answer but im not sure whether we can do this way
@samhitasegar2864
@samhitasegar2864 4 жыл бұрын
@buvanan Rajendiran - Is this correct way to get third occurence of s?
@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.
@kapilrana2361
@kapilrana2361 6 жыл бұрын
As far as I know you can not use .length( )with array. For find the length of an array you should write array.length. Like if String s = "test", the you can write s.length(). and if you have int numbers[] = {-10,-10,24,50,-88,276435}; the you can write int len = numbers.length;
@tejastoley6714
@tejastoley6714 5 жыл бұрын
length is use to find the size of the array and length() is use to find the size of the string.
@kuldeepsikka2722
@kuldeepsikka2722 5 жыл бұрын
@@kapilrana2361 you are right array.length is a variable and array.length() is a method.
@Testprofile-u8b
@Testprofile-u8b 5 күн бұрын
Using new keyword creates memory in heap and SCP . Why is that soo?
@nazimkhan9080
@nazimkhan9080 3 жыл бұрын
Lets take this example String s="_Hello_world_"; String test[]=s.split("_"); System.out.println(test.leangth);// Return 3: Why?
@aakashkhandekar
@aakashkhandekar Жыл бұрын
PLEASE MAKE VIDEOS ON ZOOM MODE. I AM NOT ABLE TO SEE YOUR CODES PROPERLY...
@manishgupta5344
@manishgupta5344 6 жыл бұрын
Hi Naveen! How to find the numbers of ‘L’ in a string “GOOGLLLLLEE”?
@_abhimanyu.
@_abhimanyu. 6 жыл бұрын
we can do this using HashMap
@romalisasamal7109
@romalisasamal7109 5 жыл бұрын
public int lengthOf() { String s="GOOGLLLLLEE"; int first=s.indexOf('L'); int last=s.lastIndexOf('L'); int counter=0; for(int i=first;i
@shankarpk89
@shankarpk89 5 жыл бұрын
String s = "GOOGLLLLLEE"; int counter =0; for(int i=0; i
@shankarpk89
@shankarpk89 5 жыл бұрын
package javaPrograms; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class CountChar { public static void main(String[] args) { String inputStr = "GOOGLLLLLEE"; Map myMap = countCharacters(inputStr); for (Entry entry : myMap.entrySet()) { System.out.println(entry.getKey() + " : " + entry.getValue()); } } public static Map countCharacters(String str) { Map map = new HashMap(); int counter = 1; for (int i = 0; i < str.length(); i++) { if (!map.containsKey(str.charAt(i))) { map.put(str.charAt(i), counter); } else { map.put(str.charAt(i), map.get(str.charAt(i)) + 1); } } return map; } }
@GreatStoriesTakeTime
@GreatStoriesTakeTime 3 жыл бұрын
String a="GOOGLLLLLEE"; int b=(int)a.chars().filter(e->e=='L').count(); System.out.print(b);
@gautamgkp65
@gautamgkp65 5 жыл бұрын
Awesome
@marine007
@marine007 5 жыл бұрын
String str="ae@io#b$u123"; Separate characters,special characters and numbers......this was a interview question. sir,plz answer this
@nandhanamtalkies2332
@nandhanamtalkies2332 5 жыл бұрын
public class StringManipulation { public static void main(String[] args) { String str2 = "ae@io#b$u123"; System.out.println("Characters are : "+ str2.replaceAll("[^a-zA-Z]", "")); System.out.println("Numbers are : "+ str2.replaceAll("[^0-9]", "")); System.out.println("Special characters are : "+ str2.replaceAll("[a-zA-Z0-9]", "")); } } O/P Characters are : aeiobu Numbers are : 123 Characters are : @#$
@shankarpk89
@shankarpk89 5 жыл бұрын
String s1 = "ae@io#b$u123"; ArrayList alString = new ArrayList(); alString.add(s1.replaceAll("[^a-z]", "")); alString.add(s1.replaceAll("[a-z0-9]", "")); alString.add(s1.replaceAll("[^0-9]", "")); System.out.println(alString);
@mesrop6339
@mesrop6339 5 жыл бұрын
Thank u
@vishalgaikwad873
@vishalgaikwad873 6 жыл бұрын
sir where is == i.e s1==s2
@dadasajad8741
@dadasajad8741 2 жыл бұрын
can somebody write here, how to find the third occurrence of 's' in string. thanks in advance. :)
@anikamehra928
@anikamehra928 2 жыл бұрын
System.out.println(str.indexOf(('s'), str.indexOf('s') + str.indexOf('s')+1));
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
Difference between Interface and Absract Class
30:52
Naveen AutomationLabs
Рет қаралды 183 М.
Top 5 Java Strings Interview Questions | Core Java Tutorial |Rahul Shetty
23:46
How to Find Duplicates Elements in Java Array? - Java Interview Questions -5
29:34
PFB #27 - String Manipulation in Java
26:50
Tech Raj
Рет қаралды 2,6 М.
Why String is Immutable and Final in Java?
19:59
Naveen AutomationLabs
Рет қаралды 89 М.
String class in Java and Usage in Selenium Webdriver
19:47
Mukesh otwani
Рет қаралды 93 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН