Add string.py

This commit is contained in:
Kaisaan 2025-05-10 03:16:13 -04:00
parent 24820eea0f
commit 2ce030e959
3 changed files with 51 additions and 3 deletions

View File

@ -106,7 +106,7 @@ fileptrend = 0x18E7C0
fileptr = fileptrstart
logfile.write("\nDATA.BIN Files\n\n")
logfile.write("\nDATA0.BIN Files\n\n")
while fileptr < fileptrend:

View File

@ -26,7 +26,7 @@ def pointer(address):
text = text[:text.find(terminator)]
return f"address {address:X}\tvalue {ptr:X}\tpointer {trueptr:X}\ttext {text}"
#return(f"{text}")
startptr = 0x2298E0
read = startptr
@ -39,12 +39,13 @@ log.write("Characters:\n")
while read < endptr:
print(f"{read:X}")
#print(f"{read:X}")
if (pointer(read) == "invalid"):
pass
else:
log.write(f"{pointer(read)}\t{index:X}\n")
#log.write(f"|`${index:X}`|{pointer(read)}| |\n")
index += 0x1
read += 0x4

47
string.py Normal file
View File

@ -0,0 +1,47 @@
import unicodedata
length = 0
counter = 0
string = ''
print("Type/Paste your text and then Enter")
while (line := input()):
string += line
#string = (input("Enter a string ").replace('\n', " "))
length = len(string)
#for char in string:
# status = unicodedata.east_asian_width(char)
# if status == 'F':
# print(char)
# length += 1
length = length + string.count(",")
counter = string.count("[PAUSE]")
if (counter > 0):
print(f"{counter} pause")
length = length - (counter * 5)
counter = 0
counter = string.count("<")
if (counter > 0):
print(f"{counter} <")
length = length - (counter * 4)
counter = 0
counter = string.count("[LINE]")
if (counter > 0):
print(f"{counter} line")
length = length - (counter * 5)
counter = 0
char = chr(length)
print(f"The string will have a converted length of {length} in hex is {length:X} its character is {char}")