java里,所有的类,不管是java库里面的类,或者是你自己创建的类,全部是从object这个类继承的.object里有一个方法就是toString(),那么所有的类创建的时候,都有一个toString的方法. 这个方法是干什么的呢? 首先我们得了解,java输出用的函数print();是不接受对象直接输出的,只接受字符串或者数字之类的输出.那么你想把一个创建好的对象拿来输出怎么办?例如: package com.spring.h3; public class Test2 { public st…
public class Test { public static void main(String[] args) { String str = ""; // list转字符串 List<String> list = new ArrayList<String>(); list.add("A"); list.add("B"); list.add("C"); str = StringUtils.join(…
public class ArrayTest3 { public static void main(String[] args){ System.out.println(toHex(60)); } //将十进制转为16进制 public static String toHex(int num){ char[] chs = new char[8];//定义容器,存储的是字符,长度为8.一个整数最多8个16进制数 int index = chs.length-1; for(int i = 0;i<8…
转载:http://my.oschina.net/jasonultimate/blog/166968 1) Since Strings are immutable in Java if you store password as plain text it will be available in memory until Garbage collector clears it and since String are used in String pool for reusability th…
第一种方法: HttpWebRequest httpwebr = (HttpWebRequest)HttpWebRequest.Create(rstr); httpwebr.Method = "GET"; Stream s =httpwebr.GetResponse().GetResponseStream(); byte[] buffer = new byte[1024]; int actual = 0; //先保存到内存流中MemoryStream MemoryStream ms =…
--将行转为字符串 select stuff((select top 20 ','+ QQ from dl_QQ where uiid=1 order by tim desc for xml path('')),1,1,'') -- ============================================= -- Description: 将字符串转为表格 /* 例:select * from [f_split]('spu0987*5//spu0988*5/spu0989*5',…
1.删除所有表 select 'drop table '+name+';' from sys.tables where name like 'DataSyncV1DelaySample%' or name like 'DataSyncV2DelaySample%' 2.递归查询 使用关键字with as with temp ( [Id], [parentid]) as ( select Id, ParentId from SysLocation where ParentId = @ParentI…
Encoding类 表示字符编码 1.字符串转换成字节数组byte[] using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FileStreamTest { class Program { static void Main(string[] args) {…
js代码: window.onload = function(){ var mian = document.getElementById( "mian" ); var mian1 = document.getElementById( "mian1" ); var str = mian.innerHTML; var arry = []; var len = str.length; for( var i = 0; i < len; i++ ){ arry[ i ]…