Monday, January 17, 2011

Here is code from Tim Patrick's library program that I am working through


Public Function GetSubStr(ByVal origString As String, _
ByVal delim As String, ByVal whichField As Integer) _
As String
' ---- Extracts a delimited string from another
' larger string
Dim stringParts() As String

' --- Handle some errors.
If (whichField < 0) Then Return ""
If (Len(origString) < 1) Then Return ""
If (Len(delim) = 0) Then Return ""

' ----- Break the string up into delimited parts
stringParts = Split(origString, delim)
' ---- See whether the part we want exists and returns it.
If (whichField > UBound(stringParts) + 1) Then Return "" _
Else Return stringParts(whichField - 1)
End Function


Here is a PHP program from lynda.com


<?php
$array1 = array(3,4,8, 15, 16, 22, 25, 42, 56, 78);
?>

Count: <?php echo count($array1); ?> <br/>
Max Value: <br/>
Min Value: <br/>
<P></p>
Sort: <?php sort($array1); print_r($array1); ?> <br/>
Reverse Sort: <?php rsort($array1); print_r($array1); ?>


Here is some JavaScript I took from Lynda.Com

window.onload = initAll();

function initAll() {
switch(navigator.platorm){
case "Win32":
alert("You're running Windows");
break;
case "MacPPC":
alert("You have a PowerPC-based Mac");
break;
case "MacIntel":
alert("You have an Intel-based Mac");
break;
default:
alert("You have a " + navigator.platform);
}
}

No comments: