First letter of each word to make a sentence

dianaandrusak99

2 Complete the sentences with words from the unit.
The first letter of each word is given.
1 Our t_____ g_______
told us some
fascinating stories as he showed us around Oxford
2 There were no s_____
rooms available, so
they put me in a room with two large beds.
3 In Mexico, we stayed in a seaside r________
which
had three pools, a club and several restaurants.
4 It’s cheaper to pay for a r______
journey
instead of buying two single tickets.​

1. There should be a stricter punishment for dropping litter. – Наказание за выброс мусора должно быть более строгим.
2. If someone shouts at you in public, you can take them to court. — Если кто-то кричит на вас в общественных местах, вы можете вызвать их в суд.
3. Do you know Sting’s song ‘If you love somebody, set them free’? — Вы знаете песню Стинга «Если ты любишь кого-то, освободи его»?
4. It always takes me hours to choose what I want to buy — I’m very indecisive. — У меня всегда занимает несколько часов, чтобы выбрать то, что я хочу купить — я очень нерешителен.
5. I have to buy special cosmetics because I have soft skin. — Я должен купить специальную косметику, потому что у меня мягкая кожа.
6. Most Hollywood films are quite predictable — you always know what’s going to happen. — Большинство голливудских фильмов вполне предсказуемы — вы всегда знаете, что произойдет.

Ok, I found a somewhat ridiculous answer which is basically concatenating a lot of ifs to loop through each word (VBA would be easier here). Below formula is for up to 9 words. If your strings have more you just have to add some FIND(A1," ")+1. Should the formula not work for you, delete the returns in it.

=IFERROR(UPPER(
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=1,IFERROR(IF(SUM(--(LEFT(A1,FIND(" ",A1)-1)={"the","of","a","and"})),"",LEFT(A1,1)),LEFT(A1,1)),"")&
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=2,IF(SUM(--(MID(A1,FIND(" ",A1)+1,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),LEN(A1))-(FIND(" ",A1)+1))={"the","of","a","and"})),"",MID(A1,FIND(" ",A1)+1,1)),"")&
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=3,IF(SUM(--(MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,IFERROR(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1),LEN(A1))-(FIND(" ",A1,FIND(" ",A1)+1)+1))={"the","of","a","and"})),"",MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,1)),"")&
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=4,IF(SUM(--(MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1,IFERROR(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1),LEN(A1))-(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1))={"the","of","a","and"})),"",MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1,1)),"")&
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=5,IF(SUM(--(MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1,IFERROR(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1),LEN(A1))-(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1))={"the","of","a","and"})),"",MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1,1)),"")&
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=6,IF(SUM(--(MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1,IFERROR(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1),LEN(A1))-(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1))={"the","of","a","and"})),"",MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1,1)),"")&
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=7,IF(SUM(--(MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1,IFERROR(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1),LEN(A1))-(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1))={"the","of","a","and"})),"",MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1,1)),"")&
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=8,IF(SUM(--(MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1)+1,IFERROR(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1)+1),LEN(A1))-(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1)+1))={"the","of","a","and"})),"",MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1)+1,1)),"")&
IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1>=9,IF(SUM(--(MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1)+1)+1,IFERROR(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1)+1)+1),LEN(A1))-(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1)+1)+1))={"the","of","a","and"})),"",MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)+1)+1)+1)+1)+1)+1,1)),"")
),"")

пожалуйста помогите !!! 3 Complete the sentences with the correct words. The first letter of each word has been given. 1 It was a bright day in July, but inside the Son Doong C_ _ _ it was very dark and cold. 2 It’s a s_ _ _ _ climb to the top of Ben Nevis in the Scottish Highlands, but the view is worth it. 3 Angel Falls, on the Guaja River in Venezuela, is the highest w_ _ _ _ _ _ _ _ in the world. 4 During the day, the temperature in the Sahara d_ _ _ _ _ can reach 50°C, but at night it sometimes falls to below 0°C. 5 The beautiful White C_ _ _ _s of Dover are very high and it’s dangerous to walk too close to the edge. 6 The edges of Lake Como in Italy are s_ _ _ _ _ _ , but it’s quite deep in the middle. 7 Over 1,500 people lost their lives in the early morning of 15 April 1912 when the Titanic sank in the i_ _ waters of the North Atlantic Ocean. 8 You can collect seashells from the s_ _ _ _ in the Maldives, but you can’t take coral pieces. Mark: ___ / 8

Last update on August 19 2022 21:50:34 (UTC/GMT +8 hours)

Java Basic: Exercise-58 with Solution

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

Pictorial Presentation: Capitalize the first letter of each word in a sentence

Java Basic Exercises: Capitalize the first letter of each word in a sentence

Sample Solution:

Java Code:

import java.util.*;
 public class Exercise58 {
     public static void main(String[] args){
	 Scanner in = new Scanner(System.in);
     System.out.print("Input a Sentence: ");
	 String line = in.nextLine();
	 String upper_case_line = ""; 
       Scanner lineScan = new Scanner(line); 
         while(lineScan.hasNext()) {
             String word = lineScan.next(); 
             upper_case_line += Character.toUpperCase(word.charAt(0)) + word.substring(1) + " "; 
         }
      System.out.println(upper_case_line.trim()); 
    }
}

Sample Output:

Input a Sentence: the quick brown fox jumps over the lazy dog.         
The Quick Brown Fox Jumps Over The Lazy Dog.

Flowchart:

Flowchart: Java exercises: Capitalize the first letter of each word in a sentence

Java Code Editor:

Contribute your code and comments through Disqus.

Previous: Write a Java program to accepts an integer and count the factors of the number.
Next: Write a Java program to convert a given string into lowercase.

Java: Tips of the Day

Java: When to use static methods?

One rule-of-thumb: ask yourself «Does it make sense to call this method, even if no object has been constructed yet?» If so, it should definitely be static.

So in a class Car you might have a method:

double convertMpgToKpl(double mpg)

…which would be static, because one might want to know what 35mpg converts to, even if nobody has ever built a Car. But this method (which sets the efficiency of one particular Car):

void setMileage(double mpg)

…can’t be static since it’s inconceivable to call the method before any Car has been constructed.

(By the way, the converse isn’t always true: you might sometimes have a method which involves two Car objects, and still want it to be static. E.g.:

Car theMoreEfficientOf(Car c1, Car c2)

Although this could be converted to a non-static version, some would argue that since there isn’t a «privileged» choice of which Car is more important, you shouldn’t force a caller to choose one Car as the object you’ll invoke the method on. This situation accounts for a fairly small fraction of all static methods, though.

Ref: https://bit.ly/3pewXbF

Like this post? Please share to your friends:
  • First letter of each word capitalized
  • First letter of a word is called
  • First letter in each word is the same
  • First letter bigger in word
  • First last names excel