String to lowercase

Por Mafcase

Master (231)

Imagen del Mafcase

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 sesión o register para postear comentarios

Por edoz

Prophet (2172)

Imagen del edoz

16-07-2019, 16:06

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

Por assembler

Champion (378)

Imagen del assembler

16-07-2019, 16:06

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

Por Mafcase

Master (231)

Imagen del Mafcase

16-07-2019, 16:07

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

Just trying to fiddle around with some basic stuff Smile

Por Mafcase

Master (231)

Imagen del Mafcase

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

Por wolf_

Ambassador_ (9769)

Imagen del wolf_

16-07-2019, 16:18

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

Por Mafcase

Master (231)

Imagen del Mafcase

16-07-2019, 16:32

@ Wolf_: Thank you very much!

Por Manuel

Ascended (15756)

Imagen del Manuel

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