Convert String to Capitalize String in java

preview_player
Показать описание
Convert String to Capitalize String in java

Schedule a meeting in case of any queries/guidance/counselling:

~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:

Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:

Naveen AutomationLabs Paid Courses:
GIT Hub Course:

Java & Selenium:

Java & API +POSTMAN + RestAssured + HttpClient:
Рекомендации по теме
Комментарии
Автор

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 =
result = result + s.replace(s.charAt(0), c)+" ";

}
System.out.println(result);
}

tapaskhandai
Автор

Thanks for covering test cases also, it actually helps to think in those directions also as a beginner in coding.

deepa
Автор

Great demonstration to make us understand the concept. Thank you!

testinginsights-muktasharma
Автор

This is: *The* Naveen Automation Lab guys....

kapilsachan
Автор

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();
-'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
-'a'+'A')); // same as above comments.
i++;
}
}
return sb.toString();
}

sureshgarine
Автор

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;
}

umeshjoshi
Автор

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

reks
Автор

Thanks Naveen for Covering the Multiple Checks concept in the video 👍😊

SarangHoley
Автор

Hi Naveen,

Any plans to do series on XCUITest and locators in this framework? Please 😄

hakimakbary
Автор

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

Ram_
Автор

Hii is there any online course is available in your lab..???

sunitasenapati
Автор

Please tell how to solve this type of string string s= 2**7***9; output like 2357859

sphanindra
Автор

Sir pls serialization in java, logging, monitoring or apps

foddiebyage
Автор

What if interviewer asks not to use any String method like toUpperCase()

immortalhuman
welcome to shbcf.ru