Recent

Author Topic: jvm IntToStr function  (Read 1570 times)

m.abudrais

  • New member
  • *
  • Posts: 42
jvm IntToStr function
« on: January 18, 2019, 10:09:18 am »
Hi
I created an Android project  using ppcjvm.exe
but i miss many basic function, how i can convert integer to string?
Code: Pascal  [Select]
  1. procedure MainActivity.onClick(para1: AVView);
  2. var
  3.   but: AWButton;
  4.   ClickNum, k: integer;
  5.   Ones: String;
  6. begin
  7.  
  8.   Inc(GlobalClickNum);
  9.  
  10.   but := para1 as AWButton;
  11. // i want to convert  GlobalClickNum to string
  12.   but.setText(JLString( 'kkk'));
  13. end;  

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7230
Re: jvm IntToStr function
« Reply #1 on: January 18, 2019, 12:13:44 pm »

inttostr()   (possibly unit sysutils)
.tostring

Thaddy

  • Hero Member
  • *****
  • Posts: 8176
Re: jvm IntToStr function
« Reply #2 on: January 18, 2019, 01:08:01 pm »
Both will do. Both require sysutils. And both work  8-)
There are other options too, like using jlInteger and call the Java methods on it (these are supported). And val and str also work.
« Last Edit: January 18, 2019, 01:11:35 pm by Thaddy »
Read the manuals and if you are a professional get a proper education in computer science. Makes the forum a lot cleaner.

m.abudrais

  • New member
  • *
  • Posts: 42
Re: jvm IntToStr function
« Reply #3 on: January 18, 2019, 01:31:59 pm »
JLInteger.Create(GlobalClickNum).toString(); worked for me thanks.
but when I try sysutils I get this Error :
unit1.pas(7,17) Fatal: Cannot find sysutils used by Unit1 of the Project Inspector.
I searched the C:\FPC\3.0.4\units but I didn't find sysutils.pp file.
may be I have problem in the compiler installation?
« Last Edit: January 18, 2019, 01:58:49 pm by m.abudrais »