String Object helps to do several things like normal string manipultation like addition, subration, concartination, substing, lenght and more
To use the Sting object, we have to import String form our package
let we see how addition letter with the String would be easier
here it will automatically convert the letter to suitable unicode for process it to concartinate with the string letter
Output :
running in the terminal
(.venv) user@user:~/tamilstring$ python3
Python 3.12.3 (main, Jun 19 2026, 12:46:00) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tamilstring import String
>>> word = String("அம்ம்")
>>> print(word + 'ஆ')
அம்மா
>>>
Output :
suppose if you want to remove a consonent or vowel letter form the last string we can able to do it
Output :
Output :
By defaut the addition and subtraction will return the
string in any cause if you want the returning object want to
same as the String you can use the object=true
from tamilString import String
word = String("அம்",object=true)
print(type(word + "மா"))
print(word.letters)
Output :
Output :
Output :
instead getting the letters individually form the String object if you like to get the whole string
without individual letter list you can get it form the string
Output :
Output :
we can able to get the string form the string object
incase if we need to change the string, string will
act as both getter and setter
from tamilString import String
word = String("வணக்கம்")
print(word.string)
word.string = "நன்றி"
print(word.string)
Output :
will we soon
By default, each declared String acts as a unique data structure instance in memory. By adding singleton=True, you register the sequence as a global resource.
from tamilString import String
# Regular separate instances
word1 = String("தமிழ்")
word2 = String("தமிழ்")
print(id(word1) == id(word2))
Singleton allocation patterns
singleton1 = String("வணக்கம்", singleton=True)
singleton2 = String("நன்றி", singleton=True)
print( id(singleton1) == id(singleton2))
print( singleton1.string)
Indexing in the string
just like the python we can do indexing
Output :
To learn about Letters
suppose while indexing if you want letter as Letter objects
we can achive that by indroducing the object=True at
String creation
from tamilString import String
word = String("வணக்கம்", object=True)
print(word[0])
print(word[0].vowel)
அ
print(word[0].consonent)
வ்
print(type(word[-1]))
Output :
from tamilString import String
Scenario A: Standard Primitive Outputs
raw_text = String("தமிழ்") print("Raw index type:", type(raw_text[0]))
Scenario B: Object Wrapper Enforcements
obj_text = String("தமிழ்", obj=True) print("Wrapped index type:", type(obj_text[0]))
print(compound + word)
print(compound + constant)
# subraction
print(compound - word)
print(compound - word)