sources/mystring.cpp

changeset 66
bd28a5730fd0
parent 14
33b8f428bacb
child 69
eb4c25284a19
equal deleted inserted replaced
65:8f47c682e248 66:bd28a5730fd0
440 } 440 }
441 441
442 // ------------------------------------------------------------------------------------------------- 442 // -------------------------------------------------------------------------------------------------
443 // 443 //
444 METHOD 444 METHOD
445 String::from_number (int a) -> String 445 String::from_number (short int a) -> String
446 { 446 {
447 char buf[32]; 447 char buf[32];
448 ::sprintf (buf, "%d", a); 448 ::sprintf (buf, "%d", a);
449 return String (buf); 449 return String (buf);
450 } 450 }
451 451
452 // ------------------------------------------------------------------------------------------------- 452 // -------------------------------------------------------------------------------------------------
453 // 453 //
454 METHOD 454 METHOD
455 String::from_number (long a) -> String 455 String::from_number (int a) -> String
456 {
457 char buf[32];
458 ::sprintf (buf, "%d", a);
459 return String (buf);
460 }
461
462 // -------------------------------------------------------------------------------------------------
463 //
464 METHOD
465 String::from_number (long int a) -> String
456 { 466 {
457 char buf[32]; 467 char buf[32];
458 ::sprintf (buf, "%ld", a); 468 ::sprintf (buf, "%ld", a);
459 return String (buf); 469 return String (buf);
460 } 470 }
461 471
462 // ------------------------------------------------------------------------------------------------- 472 // -------------------------------------------------------------------------------------------------
463 // 473 //
464 METHOD 474 METHOD
465 String::from_number (unsigned long a) -> String 475 String::from_number (unsigned short int a) -> String
476 {
477 char buf[32];
478 ::sprintf (buf, "%u", a);
479 return String (buf);
480 }
481
482 // -------------------------------------------------------------------------------------------------
483 //
484 METHOD
485 String::from_number (unsigned int a) -> String
486 {
487 char buf[32];
488 ::sprintf (buf, "%u", a);
489 return String (buf);
490 }
491
492 // -------------------------------------------------------------------------------------------------
493 //
494 METHOD
495 String::from_number (unsigned long int a) -> String
466 { 496 {
467 char buf[32]; 497 char buf[32];
468 ::sprintf (buf, "%lu", a); 498 ::sprintf (buf, "%lu", a);
469 return String (buf); 499 return String (buf);
470 } 500 }

mercurial