Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

upper case to lower case

113 views
Skip to first unread message

Walter Abadi

unread,
Sep 20, 2005, 4:38:23 PM9/20/05
to
I have a last_name and first_name with all letters in upper case, and need
to convert to first letter in upper case and the rest in lower case.
Is there a done process available to do this?
tnx


Bill Todd

unread,
Sep 20, 2005, 10:50:58 PM9/20/05
to
There is no proper case function in the Delphi RTL.

--
Bill Todd (TeamB)

Martijn Tonies

unread,
Sep 21, 2005, 3:01:52 AM9/21/05
to
> I have a last_name and first_name with all letters in upper case, and need
> to convert to first letter in upper case and the rest in lower case.
> Is there a done process available to do this?

Use the FreeUDFLib for InterBase and it's "ProperCase" function.


--
With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


Rudy

unread,
Sep 21, 2005, 4:16:19 AM9/21/05
to
Hi,

I have a function that does this, i takes in a string and returns the string
in the 'Proper' form. The OnlyFirstWord boolean state whether you should
only change the first word or all words in teh string.

class function TAppUtils.CapitaliseString(str : String; OnlyFirstWord :
Boolean) : String;
var
i : integer;
begin
if str <> '' then begin
str := Lowercase(str);
str[1] := Uppercase(str[1])[1];

if Not OnlyFirstWord then begin
for i := 1 to Length(str) do begin
if (str[i] = ' ') and (Length(Str) > i+1) then
if Str[i+1] <> ' ' then
Str[i+1] := Uppercase(Str[i+1])[1]
end;
end;
end;
result := str;
end;

Hope this helps

Rudy


"Walter Abadi" <wab...@silaba.com> wrote in message
news:4330...@newsgroups.borland.com...

krisztian pinter

unread,
Sep 21, 2005, 5:09:10 AM9/21/05
to


do it yourself. I would use

S := LowerCase(YourString);
if Length(S) > 0 then S[1] := Upper(S[1]);


works only for one-word strings.

krisztian pinter

unread,
Sep 21, 2005, 5:19:23 AM9/21/05
to
On Wed, 21 Sep 2005 11:09:10 +0200, krisztian pinter
<pint...@freemail.hu> wrote:

> S[1] := Upper(S[1]);

my bad. it is UpCase

Martijn Tonies

unread,
Sep 21, 2005, 8:41:44 AM9/21/05
to
Rudy,

I might be nitpicking ... but ...


> I have a function that does this, i takes in a string and returns the
string
> in the 'Proper' form. The OnlyFirstWord boolean state whether you should
> only change the first word or all words in teh string.
>
> class function TAppUtils.CapitaliseString(str : String; OnlyFirstWord :
> Boolean) : String;
> var
> i : integer;
> begin
> if str <> '' then begin
> str := Lowercase(str);
> str[1] := Uppercase(str[1])[1];

What if the string is like '40 beetles got it wrong'

Or: '1) jason told me to do it'

> if Not OnlyFirstWord then begin
> for i := 1 to Length(str) do begin
> if (str[i] = ' ') and (Length(Str) > i+1) then

And the string is like:
'Not at all,but he said he would do it'

The "b" won't get capitalized.

> if Str[i+1] <> ' ' then
> Str[i+1] := Uppercase(Str[i+1])[1]
> end;
> end;
> end;
> result := str;
> end;

:-)

Shane Stump

unread,
Sep 21, 2005, 9:44:52 AM9/21/05
to
The 'b' shouldn't be capitalized in that sentence!

Regards,

Shane

"Martijn Tonies" <m.to...@upscene.removethis.nospam.com> wrote in message
news:43315466$1...@newsgroups.borland.com...

Rudy

unread,
Sep 21, 2005, 10:59:10 AM9/21/05
to
> 'Not at all,but he said he would do it'
suppose if i wanted to i could ensure their is correct spacing after each
token, or do something if punctuation is found, but haven't need to so
far...

but cheers for the heads up... :-)

Rudy


"Martijn Tonies" <m.to...@upscene.removethis.nospam.com> wrote in message
news:43315466$1...@newsgroups.borland.com...

Rudy

unread,
Sep 21, 2005, 10:57:02 AM9/21/05
to

> I might be nitpicking ... but ...
> What if the string is like '40 beetles got it wrong'
> Or: '1) jason told me to do it'

:-) so far it works for me...if i get a bug/prob then i will adapt, only did
it last week :)


Paul

unread,
Sep 21, 2005, 12:09:34 PM9/21/05
to

"Walter Abadi" <wab...@silaba.com> wrote:


I don't know where you're posting from, but in Irish a valid name
would be Colm Uá hUigín and any uppercase function would produce an
error. Also, for Dutch names Johannes van der Poel - I've seen various
spellings of Dutch names where the "van's" and the "der's" sometimes
take a capital and sometimes don't. "De" is also difficult, sometimes
being Pierre de la Rue, or Pierre De La Rue, or Pierre Delarue.


When to capitalize is tricky. Also, be careful of accents which may
capitalise to "strange" characters if your machine character set is
not the application's one.


Paul...


--

plinehan __at__ yahoo __dot__ __com__

XP Pro, SP 2,

Oracle, 9.2.0.1.0 (Enterprise Ed.)
Interbase 6.0.1.0;

When asking database related questions, please give other posters
some clues, like operating system, version of db being used and DDL.
The exact text and/or number of error messages is useful (!= "it didn't work!").
Thanks.

Furthermore, as a courtesy to those who spend
time analysing and attempting to help, please
do not top post.

0 new messages