/usr/share/doc/pyxplot/html/sect0039.html is in pyxplot-doc 0.9.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: String methods</title>
<link href="sect0040.html" title="Regular expressions" rel="next" />
<link href="sect0038.html" title="Slicing strings" rel="prev" />
<link href="sec-stringvars.html" title="Strings" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0038.html" title="Slicing strings"><img alt="Previous: Slicing strings" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="sec-stringvars.html" title="Strings"><img alt="Up: Strings" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sect0040.html" title="Regular expressions"><img alt="Next: Regular expressions" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sect0001.html">Introduction to PyXPlot</a> <b>:</b>
</span>
</span><span>
<span>
<a href="chap-progDataTypes.html">Programming: Pyxplot’s data types</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sec-stringvars.html">Strings</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">String methods</b>
</span>
</span>
<hr />
</div>
<div><h2 id="a0000000040">6.2.4 String methods</h2>
<p>Strings have many methods for performing simple string manipulations. Here we list their names using the <tt class="tt">foreach</tt> command, which will be introduced in the next chapter: </p><p> <tt class="ttfamily">pyxplot> <b class="bfseries">foreach m in "".methods() { print m ; }</b></tt><br /><tt class="ttfamily">append</tt><br /><tt class="ttfamily">beginsWith</tt><br /><tt class="ttfamily">class</tt><br /><tt class="ttfamily">contents</tt><br /><tt class="ttfamily">data</tt><br /><tt class="ttfamily">endsWith</tt><br /><tt class="ttfamily">find</tt><br /><tt class="ttfamily">findAll</tt><br /><tt class="ttfamily">isalnum</tt><br /><tt class="ttfamily">isalpha</tt><br /><tt class="ttfamily">isdigit</tt><br /><tt class="ttfamily">len</tt><br /><tt class="ttfamily">lower</tt><br /><tt class="ttfamily">lstrip</tt><br /><tt class="ttfamily">methods</tt><br /><tt class="ttfamily">rstrip</tt><br /><tt class="ttfamily">split</tt><br /><tt class="ttfamily">splitOn</tt><br /><tt class="ttfamily">str</tt><br /><tt class="ttfamily">strip</tt><br /><tt class="ttfamily">type</tt><br /><tt class="ttfamily">upper</tt> </p><p>Full documentation of them can be found in Section <a></a>. As in Python, the <tt class="tt">strip()</tt> method removes whitespace characters from the beginning and end of strings, and the <tt class="tt">split()</tt> method splits a string up into whitespace-separated words. The <tt class="tt">splitOn(x)</tt> method splits a string on all occurrences of the sub-string <tt class="tt">x</tt>. The following examples demonstrate the use of some of them: </p><p> <tt class="ttfamily">pyxplot> <b class="bfseries">x="It was the best of times, it was the worst of times"</b></tt><br /><tt class="ttfamily">pyxplot> <b class="bfseries">print x.len()</b></tt><br /><tt class="ttfamily">51</tt><br /><tt class="ttfamily">pyxplot> <b class="bfseries">print x.split()[0:5]</b></tt><br /><tt class="ttfamily">["It", "was", "the", "best", "of"]</tt><br /><tt class="ttfamily">pyxplot> <b class="bfseries">print x.splitOn(",")</b></tt><br /><tt class="ttfamily">["It was the best of times", " it was the worst of times"]</tt><br /><tt class="ttfamily">pyxplot> <b class="bfseries">print x.find("worst")</b></tt><br /><tt class="ttfamily">37</tt><br /><tt class="ttfamily">pyxplot> <b class="bfseries">print x[0:24]</b></tt><br /><tt class="ttfamily">It was the best of times</tt><br /><tt class="ttfamily">pyxplot> <b class="bfseries">print x[-25:]</b></tt><br /><tt class="ttfamily">it was the worst of times</tt><br /><tt class="ttfamily">pyxplot> <b class="bfseries">print x.upper()</b></tt><br /><tt class="ttfamily">IT WAS THE BEST OF TIMES, IT WAS THE WORST OF TIMES</tt> </p><p> <tt class="ttfamily">pyxplot> <b class="bfseries">x=" BEAUTIFUL new railway bridge of the Silvery Tay,"</b></tt><br /><tt class="ttfamily">pyxplot> <b class="bfseries">print x.lstrip()</b></tt><br /><tt class="ttfamily">BEAUTIFUL new railway bridge of the Silvery Tay,</tt> </p></div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0038.html" title="Slicing strings"><img alt="Previous: Slicing strings" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="sec-stringvars.html" title="Strings"><img alt="Up: Strings" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sect0040.html" title="Regular expressions"><img alt="Next: Regular expressions" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>
</body>
</html>
|