Delphi has 'function UpCaseFirst(AStr: String): String;' lazarus / 7-LCL ---------------------------------------------------------------------- Avishai · 2012-07-11 21:16 Delphi has 'function UpCaseFirst(AStr: String): String;' I think this would be a good addition to Lazarus.  I looked for it, but didn't find it.  I wrote one quickly and it works, but I know it can be written better. I checked it on English and it did what I needed.  I also checked to see what it would do with Hebrew because Hebrew does not have 'Case'.  It did nothing and that is what I hoped for. function UpCaseFirst(AStr: AnsiString): AnsiString; var   S: AnsiString; begin   S:= LowerCase(AStr);   S[1]:= UpCase(S[1]);   Result:= S; End; Edit: I changed the code.  Better but still does not help for non-Ansi strings. ---------------------------------------------------------------------- theo · 2012-07-11 22:18 It doesn't work with UTF-8. Try  UpCaseFirst('äpfel'); ---------------------------------------------------------------------- Avishai · 2012-07-11 22:28 Thanks theo.  It's good to have your input.  By the way, what language is 'äpfel' and what does it mean? That is why I mentioned the languages I checked it with and why I said the code could be written better.  I knew that it would not work with all languages.  I will try to improve the code tomorrow, but I still think Lazarus should have it.  It's very late, I'm going to bed ---------------------------------------------------------------------- Avishai · 2012-07-12 02:15 theo, when I tried UpCase('äpfel') I got 'äPFEL'.  Is this correct?  It might be, but it looks wrong.  I have no idea about this language.  If it is not correct then maybe I don't feel so bad that my method does not work for that language.  But that does not make it right. It looks like maybe UpCase and UpperCase also need some work as well. ---------------------------------------------------------------------- Avishai · 2012-07-12 03:23 OK.  I did a little Googling and found that 'äpfel' is German for 'apple'.  I hope I got that right.  From what I could see,  UpCase('äpfel') should return 'Äpfel' and LowerCase('Äpfel') should return 'äpfel'.  Neither UpperCase nor LowerCase work that way.  They leave the 'Ä' and 'ä' unchanged.  The same with UpCase('äpfel'). Does anyone have any ideas? ---------------------------------------------------------------------- ludob · 2012-07-12 06:50 Code: [Select]uses ...,LazUTF8; function UpCaseFirst(s:string):string; var   first:integer; begin   first:=UTF8CharacterLength(@(s[1]));   result:=UTF8UpperCase(copy(s,1,first))+UTF8Lowercase(copy(s,first+1, length(s))); end; ---------------------------------------------------------------------- Avishai · 2012-07-12 10:24 ludob, that works like a charm   Thanks for your input and your time.  I checked against English, äpfel, and Hebrew and everything worked as expected.  I have already added it to my library.