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

1 comment:

  1. Is it possible to have string values that contains mixed single and double quotes. For example: vlada2='asd'""

    ReplyDelete