convert a string xxx.xxx.xxx.xxx in a number (CIDR format)
Franco Amato
eurofrank at gmail.com
Fri May 4 13:19:03 PDT 2007
Sorry but I don't understand your code.
vett is a string object?
Franco
2007/5/4, Phillip Stevens <pmstevens at verizon.net>:
>
> Hi Franco,
>
> I'm sure there is a "better" "cleaner" way, but I think this works?:
>
> vett =3D []
> vett.append("2")
> vett.append("5")
> vett.append("5")
>
> result =3D ""
> for ThisChar in vett:
> result =3D result + ThisChar
>
> print int(result,10)
>
>
> Friday, May 4, 2007, 2:07:18 PM, you wrote:
>
> > Hi people, sorry in advance for the off-topic question.
> > I have to convert a string in the format 255.255.255.0 in a number (in
> this
> > example 30).
> > code in C standard....
> > to convert a single octet (255 =3D 7, int to int) is not a problem, the
> > problem is convert a string.
> > For example if I have char vett[3] where vett[0]=3D2 vett[1]=3D5 and
> vett[2]=3D5,
> > how can I convert it in a int with the value 255???
> > Thank you
> > Franco
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20070504/e93=
a16a4/attachment.htm
More information about the wx-users
mailing list