Delphi Android, making first letters uppercase problem. But not on VCL

414 views Asked by At

I tried to look at some steps about making the word automatically become uppercase letters in the first letter. I used to use it on VCL and it works very well, but why on mobile applications it doesn't work properly. I use this code, but in edit2, the result is that I lost the first letter and the words start with the second letter that I entered in edit1, even though it starts with uppercase. Maybe someone can help me. Thank you very much

    var i, j : integer;
        s, edt2 : string;
Procedure
         j := length(edt1.Text);
            s := '';
            for i := 2 to j do
            begin
              s := s + LowerCase(edt2.Text[i]);
            end;
            edt2 := UpperCase(edtProduk.Text[1]) + s;
1

There are 1 answers

2
Xor-el On

In Delphi mobile platforms you have to understand that strings are zero-based (just like arrays).

To avoid issues, if you want to access the first index and last index of a string in a cross platform safe way, use the System.Low and System.High intrinsics on the string.