How to turn a body of symbols into a line



  • The line contains words with small letters. We need to replace the first words, the big ones.

    I decided to do this:

    1. Break the line on the symbols.
    2. Replace small symbols with big ones.
    3. The masses of the symbols be turned into a line. char[] b;

    I'm stuck in three. Who can write how to do that? You can explain or block the code.



  • You can do differently, of course, but in Java there are ways to work with the lines. I think we should do this.

    1. Break the line on the missing words and put it in the mass
    2. Go through the mass, replace the first symbols on top symbols registers and one line.

    No masses. char No use. You'll need the following methods. String and Character:

    1. http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#split-java.lang.String- - divides the line into a set of rules.
    2. http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#charAt-int- - returns the symbol on the index
    3. https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#toUpperCase-char- - Transfers to the top register
    4. http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#substring-int- - returns the submarine, starting with index

    If there are several gaps in the line and they need to be taken into account account in collecting the text back, the algorithm will be:

    In line:

    1. If there is a gap in this position, we will recall this event.
    2. Otherwise, if the symbol at the previous position was a Java gap. (usual gap, tabulation, etc.) or start of line, replaced on the top register symbol

      You'll need the following methods. StringBuilder and Character:

    1. https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html#length-- - returns the length of the line
    2. https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html#charAt-int- - returns the symbol to a given position
    3. http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isWhitespace(char) - checks whether the symbol is a Java gap.
    4. https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html#setCharAt-int-char- - replaces the symbol at the designated position
    5. http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#toUpperCase(char) - Transfers to the top register



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2