String to lowercase

By Mafcase

Champion (258)

Mafcase's picture

16-07-2019, 15:56

Hi there,

Is there someone who knows how to convert a string in MSX basic to lowercase?

The only thing i could find is: A$=CHR$(ASC(A$) AND &HDF).
But it's the other way around (this converts A$ to uppercase)

Thanks in advance

Login or register to post comments

By edoz

Prophet (2501)

edoz's picture

16-07-2019, 16:06

Are you working on a network application in basic? Wink Just wonder the need Wink

By assembler

Champion (417)

assembler's picture

16-07-2019, 16:06

A$=CHR$(ASC(A$) AND &HDF or 32)

By Mafcase

Champion (258)

Mafcase's picture

16-07-2019, 16:07

Uhm... Nope, no network app....

Just trying to fiddle around with some basic stuff Smile

By Mafcase

Champion (258)

Mafcase's picture

16-07-2019, 16:12

@ assembler: Thank you! Will try that one..

Not working the way i would like...

I would like to see the whole string being converted not only the first character...

Sorry if i wasn't clear Wink

By wolf_

Ambassador_ (10135)

wolf_'s picture

16-07-2019, 16:18

For t=0 to Len(a$)-1
output$=mid(a$,1+t,1) with magical math
Next t

By Mafcase

Champion (258)

Mafcase's picture

16-07-2019, 16:32

@ Wolf_: Thank you very much!

By Manuel

Ascended (19678)

Manuel's picture

16-07-2019, 20:54

Alternative, just for the fun of it... (but be careful with it):

10 INPUT A$
20 P=VARPTR(A$):L=PEEK(P):AD=PEEK(P+1)+256*PEEK(P+2)
30 FORI=ADTOAD+L:POKEI,PEEK(I)OR32:NEXTI
40 PRINT A$

still, it's a nice demo of VARPTR... Fun fact: if the string is a constant in the program, this code will modify the program itself Smile
This is the way you would do it in C, approximately Smile