first commit
This commit is contained in:
121
.gitignore
vendored
Normal file
121
.gitignore
vendored
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
# ---> Custom
|
||||||
|
# macOS system files
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Windows system files
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Unix/Linux system files
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# Logs and temporary files
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
.bower_components/
|
||||||
|
|
||||||
|
# Build directories
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
coverage/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# Environment and secrets
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
*.lock
|
||||||
|
*.tmp
|
||||||
|
*.cache
|
||||||
|
*.pid
|
||||||
|
|
||||||
|
# Compiled files
|
||||||
|
*.class
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
|
*.exe
|
||||||
|
|
||||||
|
# Crash reports
|
||||||
|
*.stackdump
|
||||||
|
*.dmp
|
||||||
|
*.mdmp
|
||||||
|
|
||||||
|
# External version control systems
|
||||||
|
.svn/
|
||||||
|
.hg/
|
||||||
|
.git/
|
||||||
|
.cvsignore
|
||||||
|
|
||||||
|
# Backup and leftover files
|
||||||
|
*.bak
|
||||||
|
*.old
|
||||||
|
*.orig
|
||||||
|
|
||||||
|
# Extended macOS system files
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Node.js
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
.pnpm-debug.log
|
||||||
|
|
||||||
|
# JetBrains IDEs (IntelliJ IDEA, PhpStorm, WebStorm, etc.)
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# Editor temporary files
|
||||||
|
.vscode/
|
||||||
|
*.code-workspace
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Archives
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# Framework-specific files (Symfony, React, Angular, etc.)
|
||||||
|
var/
|
||||||
|
vendor/
|
||||||
|
public/uploads/
|
||||||
|
storage/
|
||||||
|
|
||||||
|
# Testing and linting tools
|
||||||
|
eslintcache/
|
||||||
|
.jest/
|
||||||
|
.jest-cache/
|
||||||
|
.jest-output/
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
docker-compose.override.yml
|
||||||
|
.env.docker.local
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
*.log.*
|
||||||
|
*.log~
|
||||||
|
|
||||||
|
# Python
|
||||||
|
#All python cache files and folders
|
||||||
|
*.py[cod]
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
*.pdb
|
||||||
|
*.egg-info/
|
||||||
|
*.egg
|
||||||
|
*.whl
|
||||||
|
$__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
54
README.md
Normal file
54
README.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# EXO-JAVA-Manipulation des chaînes de caractères
|
||||||
|
|
||||||
|
## Objectif
|
||||||
|
|
||||||
|
Créer une application de traitement de texte permettant d'explorer et de maîtriser les différentes fonctionnalités de manipulation des chaînes de caractères en Java.
|
||||||
|
|
||||||
|
## Prérequis
|
||||||
|
|
||||||
|
- Connaître les bases de la programmation orientée objet
|
||||||
|
- Comprendre les concepts de base des chaînes de caractères
|
||||||
|
- Avoir une bonne compréhension des collections Java
|
||||||
|
|
||||||
|
## Énoncé
|
||||||
|
|
||||||
|
### Partie 1 : Traitement de base des chaînes
|
||||||
|
|
||||||
|
1. Créer une classe `TextProcessor` avec les méthodes suivantes :
|
||||||
|
- `countWords(String text)` : Compte le nombre de mots dans un texte en gérant les espaces multiples
|
||||||
|
- `countOccurrences(String text, String word)` : Compte les occurrences d'un mot sans tenir compte de la casse
|
||||||
|
- `reverse(String text)` : Inverse une chaîne à l'aide de StringBuilder
|
||||||
|
- `removeDuplicates(String text)` : Élimine les mots en double tout en conservant l'ordre d'apparition
|
||||||
|
- `extractWords(String text)` : Extrait tous les mots dans un tableau en gérant les espaces multiples
|
||||||
|
1. Implémenter des méthodes de transformation :
|
||||||
|
- `toTitleCase(String text)` : Met en majuscule la première lettre de chaque mot
|
||||||
|
- `toCamelCase(String text)` : Convertit un texte en camelCase (exemple : « hello world » → « helloWorld »)
|
||||||
|
- `toSnakeCase(String text)` : Convertit un texte en snake_case (exemple : « hello world » → « hello_world »)
|
||||||
|
- `compress(String text)` : Supprime les espaces multiples et les espaces en début et fin de texte
|
||||||
|
|
||||||
|
### Partie 2 : Formatage avancé
|
||||||
|
|
||||||
|
1. Créer une classe `TextFormatter` avec les méthodes :
|
||||||
|
- `alignLeft(String text, int width)` : Aligne le texte à gauche sur une largeur spécifiée
|
||||||
|
- `alignRight(String text, int width)` : Aligne le texte à droite sur une largeur spécifiée
|
||||||
|
- `alignCenter(String text, int width)` : Centre le texte sur une largeur spécifiée
|
||||||
|
- `createTable(List<String[]> data, int[] columnWidths)` : Génère un tableau formaté avec des colonnes de largeur définie
|
||||||
|
- `wrapText(String text, int lineWidth)` : Adapte le texte à une largeur donnée en préservant l'intégrité des mots
|
||||||
|
- `formatNumber(double number, String pattern)` : Formate un nombre selon un modèle (exemple : "%.2f")
|
||||||
|
- `formatDate(Date date, String pattern)` : Formate une date selon un modèle (exemple : "dd/MM/yyyy")
|
||||||
|
1. Implémenter des méthodes de mise en forme :
|
||||||
|
- `addBorders(String text)` : Encadre le texte avec des bordures
|
||||||
|
- `addNumbering(String text)` : Numérote les lignes du texte
|
||||||
|
- `highlightWord(String text, String word)` : Souligne un mot spécifique dans le texte
|
||||||
|
- `createReport(Map<String, Object> data)` : Génère un rapport structuré à partir des données
|
||||||
|
|
||||||
|
### Partie 3 : Analyse de texte
|
||||||
|
|
||||||
|
1. Créer une classe `TextAnalyzer` avec les méthodes suivantes :
|
||||||
|
- `getWordFrequency(String text)` : Calcule la fréquence d'apparition de chaque mot dans le texte
|
||||||
|
- `findPalindromes(String text)` : Identifie tous les palindromes présents dans le texte
|
||||||
|
- `findLongestWord(String text)` : Détermine le mot le plus long du texte
|
||||||
|
- `findShortestWord(String text)` : Détermine le mot le plus court du texte
|
||||||
|
1. Implémenter des méthodes d'analyse avancée :
|
||||||
|
- `findAnagrams(String text)` : Identifie et regroupe les anagrammes dans le texte
|
||||||
|
- `extractSentences(String text)` : Divise le texte en phrases distinctes
|
||||||
Reference in New Issue
Block a user