Convert String to Capitalize String in java

  Рет қаралды 11,180

Naveen AutomationLabs

Naveen AutomationLabs

Жыл бұрын

Convert String to Capitalize String in java
Schedule a meeting in case of any queries/guidance/counselling:
calendly.com/naveenautomation...
~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
kzbin.info%20Au...
Follow me on my Facebook Page:
/ naveenqtpexpert
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
t.me/joinchat/9FrG-KzGlvxjNmQ1
Naveen AutomationLabs Paid Courses:
GIT Hub Course:
naveenautomationlabs.com/gitc...
Java & Selenium:
naveenautomationlabs.com/sele...
Java & API +POSTMAN + RestAssured + HttpClient:
naveenautomationlabs.com/manu...

Пікірлер: 25
@tapaskhandai
@tapaskhandai Жыл бұрын
Hi Naveen Thanks for great work you are doing that helps Automation tester like me a lot. I tried this in another way like below: static void capitalizeString(String str) { String result = ""; String[] ar = str.split("\\s"); for (String s : ar) { char c = Character.toUpperCase(s.charAt(0)); result = result + s.replace(s.charAt(0), c)+" "; } System.out.println(result); }
@rgawali9
@rgawali9 Жыл бұрын
In this if I want to uppercase only 3character of 2nd word how can we do it?
@testinginsights-muktasharma
@testinginsights-muktasharma Жыл бұрын
Great demonstration to make us understand the concept. Thank you!
@deepa8177
@deepa8177 Жыл бұрын
Thanks for covering test cases also, it actually helps to think in those directions also as a beginner in coding.
@SarangHoley
@SarangHoley Жыл бұрын
Thanks Naveen for Covering the Multiple Checks concept in the video 👍😊
@sureshgarine
@sureshgarine Жыл бұрын
Hi Naveen, thank you for starting on coding questions, Please continue the good work. I solved it without Split and upper case function, making it very performant with String builder and ASCII conversion. Added comments for better reach My solution private static String camelCaseSentence(String str) { if(str.length()== 0 || str == null) return str; StringBuilder sb = new StringBuilder(); sb.append((char)(str.charAt(0) -'a'+'A'));//converting the character with ascii value, first trying to find difference and add it to ascii value of 'A' //and typecast to integer value for (int i = 1; i < str.length(); i++) { if(!(str.charAt(i)==' ')){ sb.append(str.charAt(i)); }else{ //skipping space and convert next char to upper case and increment so that it won't print again sb.append((char)(str.charAt(i+1) -'a'+'A')); // same as above comments. i++; } } return sb.toString(); }
@kapilsachan
@kapilsachan Жыл бұрын
This is: *The* Naveen Automation Lab guys....
@reks5936
@reks5936 Жыл бұрын
Hi Naveen, Thanks for your continuous videos which is very much helpful to clear the interviews.. kindly explain in a video about when to use static and non static variables in real-time testing
@umeshjoshi8047
@umeshjoshi8047 Жыл бұрын
Thanks @Naveen AutomationLabs for video . What if there is more than one space between two words of String [E.g:- String s="naveen automations labs" ] if we apply this check in for loop we can cover above case also if(word.length()>0){ //logic of converting first letter of word to captial and appending to result string; }
@naveenautomationlabs
@naveenautomationlabs Жыл бұрын
it can be easily handled by using \\s+. String words[] = str.split("\\s+");
@hakimakbary65
@hakimakbary65 Жыл бұрын
Hi Naveen, Any plans to do series on XCUITest and locators in this framework? Please 😄
@sphanindra5981
@sphanindra5981 Жыл бұрын
Please tell how to solve this type of string string s= 2**7***9; output like 2357859
@sunitasenapati6569
@sunitasenapati6569 Жыл бұрын
Hii is there any online course is available in your lab..???
@foddiebyage9696
@foddiebyage9696 Жыл бұрын
Sir pls serialization in java, logging, monitoring or apps
@Ram_5
@Ram_5 Жыл бұрын
Hi Naveen, Can you please tell me solutions for the question in the below. Split a String but don't split when character repeats.. input s="aHHHbYY"; Out put would be like output:[a, HHH, b, YY] Thanks in advance. Ragards, Kanvitha
@gagans.rgowda5820
@gagans.rgowda5820 Жыл бұрын
public static String[] split_string(String str) { String res =""; for(int i=0; i
@immortalhuman7085
@immortalhuman7085 Жыл бұрын
What if interviewer asks not to use any String method like toUpperCase()
@Savin.Shetty
@Savin.Shetty Жыл бұрын
Capture string in in char array, iterate through the array. Get ASCI value of each char subtract that with 32 your will get you upper case ASCI value, that's it. Same works the other way round, as A - 65 and a - 97, rest follows.
@sureshgarine
@sureshgarine Жыл бұрын
hi @sameer, please see my solution in the comments above. I did more efficiently
@sureshgarine
@sureshgarine Жыл бұрын
@@Savin.Shetty I did the same :)
@immortalhuman7085
@immortalhuman7085 Жыл бұрын
@@sureshgarine your comment not visible bro.
@sureshgarine
@sureshgarine Жыл бұрын
@@immortalhuman7085 can you please see, i can see it. check with in 1 hr
Method Overloading with byte,short,int,long,Integer parameters
4:18
Naveen AutomationLabs
Рет қаралды 5 М.
Vivaan  Tanya once again pranked Papa 🤣😇🤣
00:10
seema lamba
Рет қаралды 29 МЛН
КАРМАНЧИК 2 СЕЗОН 7 СЕРИЯ ФИНАЛ
21:37
Inter Production
Рет қаралды 466 М.
1 or 2?🐄
00:12
Kan Andrey
Рет қаралды 33 МЛН
#20 - Difference between Synchronization and ASynchronization Calls With Examples
18:28
String to Number without using Integer.parseInt() method
17:04
Naveen AutomationLabs
Рет қаралды 15 М.
Capitalize The First Letter of a String in Java #30
9:23
Alex Lee
Рет қаралды 38 М.
Ультрабюджетная игровая мышь? 💀
1:00
Low Price Best 👌 China Mobile 📱
0:42
Tech Official
Рет қаралды 719 М.
Неразрушаемый смартфон
1:00
Status
Рет қаралды 2,2 МЛН