Feature #1101 » string.py
| 1 |
#!/usr/bin/env python
|
|---|---|
| 2 |
# -*- coding: utf-8 -*-
|
| 3 |
# ˅
|
| 4 |
|
| 5 |
# ˄
|
| 6 |
|
| 7 |
class String(object): |
| 8 |
# ˅
|
| 9 |
|
| 10 |
# ˄
|
| 11 |
|
| 12 |
## \brief A class representing a string.
|
| 13 |
#
|
| 14 |
# This class is used for string manipulation and handling.
|
| 15 |
# Additional details about the purpose of the class can be included here.
|
| 16 |
#
|
| 17 |
# \author
|
| 18 |
# \version 1.0
|
| 19 |
# \date 2024-10-19
|
| 20 |
# \warning This class is not thread-safe.
|
| 21 |
|
| 22 |
def __init__(self, text): |
| 23 |
## \brief Constructor for the String class.
|
| 24 |
#
|
| 25 |
# Initializes a new instance of the String class.
|
| 26 |
#
|
| 27 |
# \param text The initial text for the string object.
|
| 28 |
self.text = text |
| 29 |
|
| 30 |
def length(self): |
| 31 |
## \brief Returns the length of the string.
|
| 32 |
#
|
| 33 |
# This method calculates and returns the length of the current string.
|
| 34 |
#
|
| 35 |
# \return The length of the string.
|
| 36 |
return len(self.text) |
| 37 |
|
| 38 |
def append(self, additional_text): |
| 39 |
## \brief Appends additional text to the string.
|
| 40 |
#
|
| 41 |
# Concatenates the given text to the existing string.
|
| 42 |
#
|
| 43 |
# \param additional_text The text to append to the string.
|
| 44 |
self.text += additional_text |
- « Previous
- 1
- 2
- Next »