Convert Text to dot.case
Learn how to convert text to dot.case where words are separated by dots (periods). Understand dot notation for Java package names, property keys, file extensions, and configuration systems.
Detailed Explanation
Converting Text to dot.case
dot.case separates words with periods (.) and lowercases every letter. While less common than camelCase or snake_case, dot notation is the standard in several important technical contexts.
Basic Conversion
Input: User First Name
Output: user.first.name
Input: backgroundColor
Output: background.color
Input: MAX_RETRY_COUNT
Output: max.retry.count
Where dot.case Is Used
Java Package Names
package com.example.myapp.services;
package org.apache.commons.lang3;
package io.github.username.library;
Java's package naming convention uses reverse domain notation with dots, creating a hierarchical namespace.
Configuration Property Keys
# Spring Boot application.properties
server.port=8080
spring.datasource.url=jdbc:postgresql://localhost/mydb
spring.datasource.username=admin
logging.level.root=INFO
# Gradle properties
org.gradle.jvmargs=-Xmx2048m
org.gradle.parallel=true
JavaScript Object Access
// Dot notation for object property access
user.profile.firstName
config.database.host
process.env.NODE_ENV
Bundle Identifiers
com.apple.mobilesafari
com.google.chrome
org.mozilla.firefox
iOS and Android apps use reverse-domain dot notation for unique bundle/package identifiers.
Conversion Algorithm
- Split the input into words (by spaces, underscores, hyphens, or case transitions).
- Lowercase every word.
- Join with dots (
.).
dot.case vs. Other Cases
dot.case: user.first.name
kebab-case: user-first-name
snake_case: user_first_name
camelCase: userFirstName
Hierarchical Nature
Unlike other naming conventions, dot.case implies a hierarchical structure. Each dot represents a level of nesting:
spring.datasource.url
└── spring
└── datasource
└── url
This makes it natural for configuration systems where properties are organized in a tree structure.
Edge Cases
- Single word:
"hello"→"hello". - Already dot.case: passes through unchanged.
- Consecutive dots should be collapsed:
"a..b"→"a.b". - File extensions (e.g.,
"index.html") may need special handling to avoid splitting at the extension dot.
Use Case
dot.case is essential for Java/Kotlin package naming, Spring Boot configuration properties, Gradle build settings, iOS/Android bundle identifiers, and hierarchical key-value configuration systems. It is also used in logging frameworks for logger names and in message broker topic naming conventions.