upper/lower

upper/lower

Postby Silvio.Falconi » Tue Jan 22, 2019 4:03 pm

exist a function to change the first letter Upper and the other lower of a string ?
sample I have ---> PALMA I wish ---> Palma
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm

Re: upper/lower

Postby ukoenig » Tue Jan 22, 2019 4:38 pm

Silvio,

StrCapFirst( <cString> ) --> cCnvString

This function capitalize the first character and transform the other charaters to lowercase.

Sample:

local cString := "text TO CONVERT" cString := StrCapFirst( cString ) ? cString --> "Text to convert"

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: upper/lower

Postby karinha » Tue Jan 22, 2019 7:26 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7613
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: upper/lower

Postby Rick Lipkin » Tue Jan 22, 2019 9:57 pm

Silvo

I wrote this function that automatically puts the very first letter as caps .. then searches for a space in the string then +1 capitalizes the next letter .. and so on thru the string.

Rick Lipkin



Code: Select all  Expand view

//------------------
Func _UpperLower( cText )

Local nLen,i,cField

nLen  := len( cText )

For i = 1 to Len(cText)

   If i = 1
      cField := upper(substr(cText,i,1))
      Loop
   Endif

   // check for multiple words
   // use space as the delimeter

   If substr(cText,i,1) = space(1) // found a space in between words
      i++
      cField := cField+" "+upper(substr(cText,i,1))
      loop
   Else
      cField := cField+lower(substr(cText,i,1))
   Endif

Next

cText := cField

Return(cText)

 
User avatar
Rick Lipkin
 
Posts: 2657
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: upper/lower

Postby Silvio.Falconi » Wed Jan 23, 2019 10:44 am

thanks to all
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 24 guests