Page 1 of 1

Upper, Lower, Proper

PostPosted: Tue Feb 21, 2017 1:05 am
by StarterPack
Hi guys

I know about the StrUpper and StrLower. I need the "Proper" function. Is it possible?

Re: Upper, Lower, Proper

PostPosted: Tue Feb 21, 2017 6:28 am
by Gaev
StarterPack:

1) http://neosoftwarecom.ipower.com/neoboo ... =9&lid=282 - does Title Case - check NeoBook Resource Center ... there might be other plugins that provides such tranformations.

2) you can build a generic routine (GoSub or Call) that ...

- accepts a sentence text e.g. [MySentence]

- uses StrParse to split it into words

- then loops through each array item ...
-- uses SubStr to extract the first character
-- uses StrUpper to convert it
-- uses [b]StrReplace[b] to replace the first character
-- adds the Titled word and a space to something like [TitledSentence]

Re: Upper, Lower, Proper

PostPosted: Tue Feb 21, 2017 7:45 am
by virger
Yo uso esta funcion
I use this function
La Funcion/The Function
Code: Select all
{NeoBook Function}
Version=5,80
Language=JScript
Param=[%str]|Variable|Texto A 'Capitalizar'
{End}
var str = nbGetVar("[%str]");
nbSetVar("[%str]",str.replace(/(\b\w)/gi,function(m){return m.toUpperCase();}));


Boton de Ejemplo/The Button Sample
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=PushButton4
X=253
Y=135
W=248
H=50
Anchor=0
Text=Capitalice¶[tx]
Align=1
ImageStyle=0
XPTheme=Yes
ObjAction=setvar "[Tx]" "hola gdo san como estas?"¶Call "MiCapi" "[tx]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=6


Enjoy

Re: Upper, Lower, Proper

PostPosted: Wed Feb 22, 2017 2:42 am
by StarterPack
Thank you guys for the reply

What I did was...

StrReplace "[Name]" "[Name]" " [Name]" "[Name]"
StrReplace "[Name]" " a" "A" "[Name]" ""
StrReplace "[Name]" " b" "B" "[Name]" ""
StrReplace "[Name]" " c" "C" "[Name]" ""
till
StrReplace "[Name]" " z" "Z" "[Name]" ""
StrDel "[Name]" "1" "1" "[Name]"

This works for me just fine

... but this is only if you want to use it in 1 line like TextEntry

Re: Upper, Lower, Proper

PostPosted: Wed Feb 22, 2017 5:54 am
by virger
?????????????????