Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 01, 2008 Conversion (silly question, sorry) | ||||
---|---|---|---|---|
| ||||
Sorry for the silly question: how can i convert from string to int? And viceversa from int to string? Thx. |
January 02, 2008 Re: Conversion (silly question, sorry) | ||||
---|---|---|---|---|
| ||||
Posted in reply to renoir | On Tue, 01 Jan 2008 18:32:32 -0500, renoir wrote: > Sorry for the silly question: > how can i convert from string to int? And viceversa from int to string? > Thx. Have a look at the std.conv module. string s; double f; s = std.conv.to!(string)(23.45); f = std.conv.to!(double)(s); -- Derek Parnell Melbourne, Australia skype: derek.j.parnell |
January 02, 2008 Re: Conversion (silly question, sorry) | ||||
---|---|---|---|---|
| ||||
Posted in reply to renoir | "renoir" <renato@rexlen.it> wrote in message news:fleiig$28gg$1@digitalmars.com... > Sorry for the silly question: > how can i convert from string to int? And viceversa from int to string? > Thx. If you're using D1, use std.string.toString to convert most basic types to strings and std.conv.toInt to convert from strings to ints. |
January 02, 2008 Re: Conversion (silly question, sorry) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote: > "renoir" <renato@rexlen.it> wrote in message news:fleiig$28gg$1@digitalmars.com... >> Sorry for the silly question: >> how can i convert from string to int? And viceversa from int to string? >> Thx. > > If you're using D1, use std.string.toString to convert most basic types to strings and std.conv.toInt to convert from strings to ints. Or get std2 from dsource and use things like std2.conv.to!(double)(s). http://www.dsource.org/projects/std2 --bb |
Copyright © 1999-2021 by the D Language Foundation