📝 Text Module

The Text module provides utilities for formatting, cleaning, and analyzing text in a simple and consistent API.


🚀 Quick Example

💻 Code


import allkitpy

print(allkitpy.text.uppercase("hello world"))

✅ Output


HELLO WORLD

✨ Formatting Functions

uppercase()

Converts all characters in a string to uppercase.

💻 Code


import allkitpy

print(
    allkitpy.text.uppercase("hello world")
)

✅ Output


HELLO WORLD
📘 Note: This function is case-sensitive and works on any string input.
upper()

Alias of uppercase(). Converts text to uppercase.

💻 Code


import allkitpy

print(allkitpy.text.upper("hello world"))

✅ Output


HELLO WORLD
lowercase()

Converts all characters in a string to lowercase.

💻 Code


import allkitpy

print(allkitpy.text.lowercase("HELLO WORLD"))

✅ Output


hello world
lower()

Alias of lowercase(). Converts text to lowercase.

💻 Code


import allkitpy

print(allkitpy.text.lower("HELLO WORLD"))

✅ Output


hello world
title()

Converts text to title case (first letter of each word capitalized).

💻 Code


import allkitpy

print(allkitpy.text.title("hello world from allkitpy"))

✅ Output


Hello World From Allkitpy
capitalize()

Capitalizes only the first character of the string.

💻 Code


import allkitpy

print(allkitpy.text.capitalize("hello world"))

✅ Output


Hello world
remove_spaces()

Removes all spaces from the text.

💻 Code


import allkitpy

print(allkitpy.text.remove_spaces("hello world from allkitpy"))

✅ Output


helloworldfromallkitpy
remove_extra_spaces()

Removes extra spaces and keeps only single spacing between words.

💻 Code


import allkitpy

print(allkitpy.text.remove_extra_spaces("hello     world   from   allkitpy"))

✅ Output


hello world from allkitpy
remove_numbers()

Removes all numeric digits from the text.

💻 Code


import allkitpy

print(allkitpy.text.remove_numbers("a1b2c3d4"))

✅ Output


abcd
word_count()

Counts the number of words in a string.

💻 Code


import allkitpy

print(allkitpy.text.word_count("hello world from allkitpy"))

✅ Output


4
char_count()

Counts total characters in the string including spaces.

💻 Code


import allkitpy

print(allkitpy.text.char_count("hello"))

✅ Output


5
sentence_count()

Counts number of sentences separated by dots.

💻 Code


import allkitpy

print(allkitpy.text.sentence_count("hello world. this is allkitpy."))

✅ Output


2