diff options
author | Puneeth Chaganti | 2010-10-11 11:40:04 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2010-10-11 11:40:04 +0530 |
commit | 98aafc8888970c0dc6da22cfb057c103334065ed (patch) | |
tree | e5e1b2b8f0255a378f8202668bc182592c4dc1f4 /manipulating-strings | |
parent | f09d82f3c8f5a84ece5a42412e31cf1c71b89ea9 (diff) | |
download | st-scripts-98aafc8888970c0dc6da22cfb057c103334065ed.tar.gz st-scripts-98aafc8888970c0dc6da22cfb057c103334065ed.tar.bz2 st-scripts-98aafc8888970c0dc6da22cfb057c103334065ed.zip |
Quickrefs
Diffstat (limited to 'manipulating-strings')
-rw-r--r-- | manipulating-strings/quickref.tex | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/manipulating-strings/quickref.tex b/manipulating-strings/quickref.tex index b26d168..533a1ef 100644 --- a/manipulating-strings/quickref.tex +++ b/manipulating-strings/quickref.tex @@ -1,8 +1,14 @@ -Creating a linear array:\\ -{\ex \lstinline| x = linspace(0, 2*pi, 50)|} +\textbf{Manipulating strings} -Plotting two variables:\\ -{\ex \lstinline| plot(x, sin(x))|} +String indexing starts from 0, like lists. -Plotting two lists of equal length x, y:\\ -{\ex \lstinline| plot(x, y)|} +\lstinline|s = `Hello World'|\\ +\lstinline|s[0:5]| gives \texttt{Hello}\\ +\lstinline|s[6:]| gives \textt{World}\\ +\lstinline|s[6::2]| gives \textt{Wrd}\\ + +\lstinline|s.replace('e', 'a')| returns a new string with all e's +replaced by a. + +\lstinline|s.lower()| and \lstinline|s.upper()| return new strings +with all lower and upper case letters, respectively. |