HP Caliper Advisor Rule Writer Guide

Table A-1 Python Built-In String Operations (continued)
DescriptionReturnsFunction
counts the number of substring sup in string sintegers.count(sub)
tests if string s starts with substring subbooleans.startswith(sub)
tests if string s ends with substring subbooleans.endswith(sub)
split string s into substrings based on separator string sepstringss.split(sep)
split string s into substrings based on line breaksstringss.splitlines()
joins a set of strings with string sep in between eachstringsep.join(strings)
replace all occurances of substring old with new in string sstrings.replace(old, new)
capitalize the first letter of string sstrings.capitalize()
converts all letters in string s to upper casestrings.upper()
converts all letters in string s to lower casestrings.lower()
converts the first letter of all words in string s to upper casestrings.title()
strips all leading and trailing whitespace from string sstrings.strip()
strips all leading whitespace from string sstrings.lstrip()
strips all trailing whitespace from string sstrings.rstrip()
70 Python Scripting Language: Overview