Sunday, August 16, 2009

WSAdmin Command Reference

Jython Commands:

Strings:
Strings can be either in double quotes or single quotes:
a="Hello World"
a='Hello World'


Strings Functions:
print: Use the print command to print a string to standard out
print a
Hello World

char: get the nth character of a string by treating the entire string like an array:
print a[6]
W
print a[0]a[1]a[2]
Hel

concatenation: in jython it's a '+'
print a[0]+' ' + a[1] + ' ' + "End"
H e End

lstrip() - cuts off white space characters from the left side of the string
b=' \nWorld'
print b

World
print b.lstrip()
World

rstrip()- custs off whitespace characters from the right side of the string
b='Hello \n'
print b
Hello

print b.rstrip()
Hello

len() returns the length of the string:
b='Hello'
print len(b)
5

comparison- just us an "=="
if "hello"=="world":
print "they are equal"
else:
print "they are not equal"
they are not equal

Introduction

I've been witting WebSphere scripts for years. Everytime I write scripts for a client I find myself constantly asking the same questions. Yes this means I actually do write scritps custom for each client!

I'm writting this as a quick and easy refernce you can use to quickly access. In addition I'll be taking questions (and responding) to your WebSphere scripting questions.