/ Forside / Teknologi / Udvikling / Java / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Java
#NavnPoint
molokyle 3688
Klaudi 855
strarup 740
Forvirret 660
gøgeungen 500
Teil 373
Stouenberg 360
vnc 360
pmbruun 341
10  mccracken 320
to print out with specified format?
Fra : somez72


Dato : 06-07-01 09:31

Hi,all
I want to disply string with specified format.

for example in c
char * string_variable1 = "abc";
char * string_variable2 = "def";
int int_variable = 5;

printf ( "%20s %20s %05d" , string_variable1 , string_varible2 ,
int_varialbe ) ;

====> abc def
00005
|space for 20 character |space for 20 character | five
digit for integer variable

I'm looking for this kind of funciton to make buffering with specified
format of some variables.

does it supported in Java?

Best Regards,
Sun Haeng.



 
 
Lars Hansen (07-07-2001)
Kommentar
Fra : Lars Hansen


Dato : 07-07-01 08:44

Hi the printf function is not implemented in java,
but if you search for "java printf" on www.google.com and push "I feel
lucky"
you will get a link to a free implementation, otherwise you have to do it
yourself with stringconcatenation

Best regards

Lars Bo Hansen
"somez72" <somez72@chollian.net> wrote in message
news:9i24lk$7b6$1@news1.kornet.net...
> Hi,all
> I want to disply string with specified format.
>
> for example in c
> char * string_variable1 = "abc";
> char * string_variable2 = "def";
> int int_variable = 5;
>
> printf ( "%20s %20s %05d" , string_variable1 , string_varible2 ,
> int_varialbe ) ;
>
> ====> abc def
> 00005
> |space for 20 character |space for 20 character | five
> digit for integer variable
>
> I'm looking for this kind of funciton to make buffering with
specified
> format of some variables.
>
> does it supported in Java?
>
> Best Regards,
> Sun Haeng.
>
>



Søg
Reklame
Statistik
Spørgsmål : 177552
Tips : 31968
Nyheder : 719565
Indlæg : 6408849
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste