עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

איך להפוך מDOUBLE לSTRING בJAVA...?

Featured Replies

פורסם

יש לי ערך של DOUBLE שאני רוצה שהוא יכנס לתוך STRING איך שהוא...

יעני אם רשום בDOUBLE

543.34

אז בSTRING יהיה רשום אותו דבר (רק שהוא יחשוב שזה תווים כאילו)

ניסיתי לעשות CASTING הקומפיילר אמר שאי אפשר

ניסיתי לעשות parseString אבל אין לSTRING תפקודה הזאת בכלל

משהו יודע?

SweeT EviL

פורסם

אני חושב שהדרך הכי פשוטה היא:

str = "" + dbl

פורסם

אני א יודע אם יש מחלקה שעושה את זה אוטומטית,, אבל לא אמורה להיות בעיה לממש את זה בעצמך :


Integer a = new Integer(534);
Integer b = new Integer(34);
String txt = a.toString()+"."+b.toString();

עכשיו כל מה שנשאר זה לזהות את הנקודה העשרונית כדי שתוכל להכליל את הפתרון. זו בעיה פשוטה יחסית ואני מציע לך לנסות להתמודד איתה.

מטי.

פורסם


double a=534.34;
String b=Double.toString(a);

או


String b=String.valueOf(a);

פורסם
  • מחבר

תודה

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.