https://github.com/bingus-dev/ilen
Return index of the last item in table or string, rather than it's length
https://github.com/bingus-dev/ilen
python python3
Last synced: about 1 year ago
JSON representation
Return index of the last item in table or string, rather than it's length
- Host: GitHub
- URL: https://github.com/bingus-dev/ilen
- Owner: bingus-dev
- Created: 2024-07-12T23:36:03.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-09T20:12:39.000Z (over 1 year ago)
- Last Synced: 2025-03-17T15:26:07.778Z (about 1 year ago)
- Topics: python, python3
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ilen (index-len)
This is a very basic Python module that checks for length of strings and lists like ``len()``, however, it returns the **index of the last item**, rather than the length of the whole table.
## Usage Example
```py
from ilen import ilen
# Get the last item in the table
table_1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 01, 11]
table_1_last_item = ilen(table_1) # 11
string_1 = "1 2 3 4 5 6 7 8 9 01 11"
string_1_last_char = ilen(string_1) # 1
print(str(table_1_last_item) + string_1_last_char) # 111
```