Aller au contenu
Accueil moxon

Casse

L'endpoint /case convertit un texte entre 9 formats de casse avec une tokenisation universelle (split camelCase, _, -, ., espaces).

gethttps://api.moxon.dev/v5/case
Essayerget/v5/case

Paramètres

  • textstringrequis
    —

    Texte à convertir

  • tostringoptionnel

    Par défaut : camel.

    Format cible

    • camel
    • pascal
    • snake
    • kebab
    • constant
    • title
    • sentence
    • upper
    • lower

Formats disponibles

FormatDescriptionExemple (hello_world)
camelcamelCasehelloWorld
pascalPascalCaseHelloWorld
snakesnake_casehello_world
kebabkebab-casehello-world
constantCONSTANT_CASEHELLO_WORLD
titleTitle CaseHello World
sentenceSentence caseHello world
upperMAJUSCULESHELLO_WORLD
lowerminusculeshello_world

Champs de réponse

  • textstring

    Le texte d'entrée

  • tostring

    Le format cible

  • resultstring

    Le texte converti

Exemples de code

Gestion des erreurs

Si les paramètres sont manquants ou invalides, l'API retournera une erreur :

  • 400Please provide a text (?text={text})Le paramètre text est manquant
  • 400Text cannot exceed 1000 charactersLe text dépasse la longueur maximale
  • 400Text must contain at least one alphanumeric characterLe text ne contient que des séparateurs/de la ponctuation (ex. ---), sans rien à convertir
  • 400Invalid target case. Valid values: camel, pascal, snake, kebab, constant, title, sentence, upper, lowerLa valeur de to n'est pas valide