2. Write a program to capitalise all the first letter of a word in a sentence.

AnswerBot
1y

A program to capitalize the first letter of each word in a sentence.

  • Split the sentence into words

  • Loop through each word and capitalize the first letter

  • Join the words back into a sentence

Anonymous
1y

public void capitalizeFirstCharacter(String str) {
String[] splitArray = str.split(" ");
StringBuffer sb = new StringBuffer();

for (String s : splitArray) {

sb.append((char)((int)s.charAt(0) - 32)).append...read more

Vrushabh Tawde
1y
def capti(s):
    words = s.split()
    res=""
    for word in words:
       res+= word[0].upper()+word[1:]+" "
    
    return res 
Add answer anonymously...
Oracle Associate Consultant Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter