Salta al contenuto
0
  • Categorie
  • Recenti
  • Tag
  • Popolare
  • Mondo
  • Utenti
  • Gruppi
  • Categorie
  • Recenti
  • Tag
  • Popolare
  • Mondo
  • Utenti
  • Gruppi
Collassa

Forum Federato

Di Piero Bosio
  1. Home
  2. Categorie
  3. Senza categoria
  4. #lua question: If I want to check whether all the characters in a string are upper case, (so that it returns `true`), how do I go about doing this?

#lua question: If I want to check whether all the characters in a string are upper case, (so that it returns `true`), how do I go about doing this?

Pianificato Fissato Bloccato Spostato Senza categoria
luaprogrammingquestionlearning
2 Post 2 Autori 1 Visualizzazioni
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Topic risposta
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • Jectoons :krita: :debian:undefined Questo utente è esterno a questo forum
    Jectoons :krita: :debian:undefined Questo utente è esterno a questo forum
    Jectoons :krita: :debian:
    scritto su ultima modifica di
    #1

    #lua question: If I want to check whether all the characters in a string are upper case, (so that it returns `true`), how do I go about doing this?

    My initial thought is

    `function uc(inp)
    if string.match(inp, "%u") and inp ~= string.match(inp, "%l") then
    return true
    else
    return false
    end
    end
    `

    And this returns true for "H" and false for "h", but true for "Hh"...

    any ideas?
    #programming #question #learning

    xrvsundefined 1 Risposta Ultima Risposta
    2
    • Jectoons :krita: :debian:undefined Jectoons :krita: :debian:

      #lua question: If I want to check whether all the characters in a string are upper case, (so that it returns `true`), how do I go about doing this?

      My initial thought is

      `function uc(inp)
      if string.match(inp, "%u") and inp ~= string.match(inp, "%l") then
      return true
      else
      return false
      end
      end
      `

      And this returns true for "H" and false for "h", but true for "Hh"...

      any ideas?
      #programming #question #learning

      xrvsundefined Questo utente è esterno a questo forum
      xrvsundefined Questo utente è esterno a questo forum
      xrvs
      scritto su ultima modifica di
      #2

      Jectoons :krita: :debian: you can convert the string to upper case and see if it's changed

      1 Risposta Ultima Risposta
      2
      • rag. Gustavino Bevilacquaundefined rag. Gustavino Bevilacqua ha condiviso questa discussione
        Oblomovundefined Oblomov ha condiviso questa discussione
      Rispondi
      • Topic risposta
      Effettua l'accesso per rispondere
      • Da Vecchi a Nuovi
      • Da Nuovi a Vecchi
      • Più Voti


      • Accedi

      • Accedi o registrati per effettuare la ricerca.
      • Primo post
        Ultimo post