• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Woop missing code

Started by Robert Sarrazin, January 27, 2008, 03:59:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Robert Sarrazin

Nice to said Hi to everybody. :)

How to got first letter UPPER

exp.

local txt as string
txt = robert

What I need is Robert  :-[
many time I want to convert when INPUT data
from textbox 8)
Thanks

Kent Sarikaya

#compile exe
#dim all

function pbmain () as long

    local txt as string
    txt = "roBeRt"
   
    txt = ucase$(left$(txt, 1)) + lcase$(right$(txt,len(txt)-1))
    msgbox txt

end function


This will make the first letter upper case and the rest lower case, hopefully :)

José Roca

 
You can also use MCASE$(txt). See the PowerBASIC help file:

MCASE$ function

Purpose
Return a mixed case version of its  argument.

Syntax
s$ = MCASE$(string_expression [,ANSI | OEM])

Remarks
Forces the string_expression contents to mixed case.  The first letter of each word is capitalized, while the remaining characters are converted to lowercase.  A "word" is construed as a consecutive series of letters - any character that is not a letter is not considered part of a word.

The optional ANSI or OEM parameter specifies whether string_expression is converted to mixed case using the ANSI or OEM charset. If no charset option is selected, then the ANSI chareset is used to convert string_expression to mixed case. The PowerBASIC Console Compiler defaults to using the Console's OEM charset to convert string_expression. Only "International" characters in the range CHR$(128) to CHR$(255) are affected by the charset parameter.

See also
LCASE$, UCASE$

Example
x$ = MCASE$("Cats aren't AL.WAYS good.")

Result
Cats Aren'T Al.Ways Good.