How to make an algorithm to turn capital letters into lowercase letters?

Asked

Viewed 2,887 times

2

I need an algorithm that accepts a string or literal expression in uppercase or lowercase. Example:

leia(nome)

Independent of entry:

So-and-so, so-and-so or SO

The output of the code escreva(nome) must be:

so-and-so

  • 1

    Cool. And what you’ve done so far?

  • if (stageCivil="married") or (stageCivil="MARRIED")

  • But how does that relate to your question?

  • want a way that regardless of the input : Married, MARRIED, Married Married Married Married Married Married. The algorithm recognizes the input as valid.

  • 1

    +1 by the question, legal the questioning in relation to the use of portugol^^

  • 1

    @alexjosesilva your comments have left me a little confused, you just want to convert to all tiny or want to validate whether what was typed is tiny or not?

  • Thanks for the Math response. I want you both: Validate a conditional and convert any entry to minuscule. Thanks for the help

Show 2 more comments

1 answer

5


Portugol has a function that treats this, is the function caracteres_minusculos.

From the documentation (which is inside the software itself):

Biblioteca Texto
funcao cadeia caracteres_minusculos(cadeia cad)

Description: Turns string characters into lowercase characters

Parameters:
Cad: any string type value
Returns: the string with the transformed characters

Remember to import the library Texto to be able to use the character conversion function correctly.

Full example:

programa
{
    inclua biblioteca Texto --> txt
    funcao inicio()
    {
        cadeia texto
        leia(texto)
        escreva("Texto convertido para minúsculo: ", txt.caracteres_minusculos(texto) )
    }
}
  • I’m using Visualg, as this inclusion would be. Remembering that my code looks like this:algorithm "REPEAT" var I:integer start // Repeat FOR I 0 ATE 20 KNIFE SCRIBAL(" ",I) FIMPARA fimalgoritmo

  • @alexjosesilva what is Visualg? Is another name for Portugol? Anyway, it wouldn’t be the case to be a separate question?

  • Visualg is the IDE for reading algorithms. The above answer is a bit confusing!

  • @alexjosesilva understood, this is another IDE, similar to Portugol. The above answer just transforms all characters into lowercase characters of any user typed text, I suggest you run the above code and do a test. You had said that you want to make a validation of some condition, but so far I did not understand which, could explain me?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.