Skip to content

Casse

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

Paramètres

ParamètreRequisDéfautDescription
textOuiTexte à convertir
toNoncamelFormat cible

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

ChampTypeDescription
textstringLe texte d'entrée
tostringLe format cible
resultstringLe texte converti

Exemples de code

curl -X GET \
  "https://api.sylvain.sh/v5/case?text=hello_world&to=pascal"

Essayer

Gestion des erreurs

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

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