devxlogo

Tip Bank

Use SimpleDateFormatter for Date and Text Conversion

The following code shows you how to use SimpleDateFormatter for date and text conversion: java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(“EEE MMM d hh:mm:ss yyyy”); java.util.Date date1 = null;try{ date1 = formatter.parse(“Thu

Storing Values in a Windows Registry with VB

The following code allows you to permanently store values in a Windows registry and retrieve them later: SaveSetting appname:=”ABCX”, Section:=”Startup”, Key:=”samp”, setting:=”Y” You can either check in the Windows registry

Pass a Multi-dimensional Array to a Routine

Passing a multi-dimensional array to a routine is different in .NET. For example, say you have a two-dimensional array called aStrMy2DArray(10,1) as a String data type. Use this code to

Using XPathDocument in XPath Queries

Don’t use the XmlDocument class if you are going to work with XPath queries. .NET has its own class for this purpose called XPathDocument, which does not run any validation

Generate a String of Specified Characters and of Desired Length

The following function generates a string of specified characters and of desired length: public static String getStringOfChars(char ch,int length) { StringBuffer sb=new StringBuffer(); sb.setLength(length); return sb.toString().replace(‘u0000’,ch); }