http://hongmin118.iteye.com/blog/2029728 转的 MySQL 的CAST()和CONVERT()函数可用来获取一个类型的值,并产生另一个类型的值.两者具体的语法如下: CAST(value as type); CONVERT(value, type); 就是CAST(xxx AS 类型), CONVERT(xxx,类型). mysql> SELECT CAST('3.35' AS signed); +------------------------+ |
今天鹅厂店面,最后问了一个ip地址字符串和整数间无损转化的问题,晚上有时间了手撸了一下代码. public class IPstr { public static void main(String args[]){ ipstrToint sti=new ipstrToint(); int ip=0; ip=sti.strToint("127.11.22.33"); if(ip==0) System.out.println("无效IP"); else System.o
public static int parseInt(String s, int radix) throws NumberFormatException{ /* * WARNING: This method may be invoked early during VM initialization * before IntegerCache is initialized. Care must be taken to not use * the valueOf method. */ if (s =
//字符转整形 String aa = "23"; //int bb = Integer.parseInt(aa);//两种方式都是可以的 int bb = new Integer(aa); System.out.println(bb); //整形转字符 int aaa = 100; String a = String.valueOf(aaa);//整形转字符 System.out.println(a);