JDev

Code, javaNovember 13, 2008 5:54 pm

Use a Pattern  class from the java.util.regex package to split a long string into separate words in Java.

A Pattern is a compiled representation of a regular expression.

String str = "a     very long   string   possibly with   line breaks  ,  tab   delimiters etc";

Pattern p = Pattern.compile("[,\\s]+");
String[] arr = p.split(str);          

Code, .NETNovember 7, 2008 9:25 pm

 

I use this function found on the stackoverflow site to check whether a string is a number:

return System.Text.RegularExpressions.Regex.IsMatch
         (TextValue, @"^-?\d+([\.]{1}\d*)?$");

 It recognizes integers and decimals. However, it fails on comma separators.

 

More tips at http://c-sharpe.blogspot.com/

Code, VBANovember 3, 2008 4:38 pm

Here is a VBA function that converts a column reference to a column index.

Function ColRef2ColNo(ColRef As String) As Integer    
      ColRef2ColNo = 0
     On Error Resume Next
   ColRef2ColNo = Range(ColRef & "1").Column
End Function