File: substring-doc.m2

package info (click to toggle)
macaulay2 1.25.05%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 172,152 kB
  • sloc: cpp: 107,824; ansic: 16,193; javascript: 4,189; makefile: 3,899; lisp: 702; yacc: 604; sh: 476; xml: 177; perl: 114; lex: 65; python: 33
file content (87 lines) | stat: -rw-r--r-- 1,968 bytes parent folder | download | duplicates (2)
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
-- author: Lily Silverstein

doc ///
 Key
  substring
  (substring, String, ZZ)
  (substring, ZZ, String)
  (substring, ZZ, ZZ, String)
  (substring, String, ZZ, ZZ)
  (substring, Sequence, String)
 Headline
  extract part of a string
 Usage
  substring(i, s)
  substring(i, n, s)
  substring(s, i, n)
  substring(s, i)
  substring((i, n), s)
 Inputs
  i:ZZ
   starting index of substring
  n:ZZ
   length of substring
  s:String
 Outputs
  :String
 Description
  Text
   The expressions {\tt substring(i, n, s)}, {\tt substring(s, i, n)}, and 
   {\tt substring((i, n), s)} all return the substring that starts at index 
   {\tt i} and has {\tt n} characters.
   
   In other words, if $s=s_0s_1s_2\ldots s_k$, then 
   the substring returned is $s_i s_{i+1}\ldots s_{i+n-1}$.
   
   Indices begin at zero, and a negative index is counted from
   the end of the string. Requests for out-of-bound character positions
   are silently ignored.
  Example
   s = "I love computing Gröbner bases in Macaulay2.";
   substring(0, 5, s)
   substring(s, -10, 5)
   substring(s, 100, 5)
   substring((3, 10), s)
  Text
   The expressions {\tt substring(i, s)} and {\tt substring(s, i)} return
   the substring that starts at index {\tt i} and continues to the end of the string.

   In other words, if $s=s_0s_1s_2\ldots s_k$, then 
   the substring returned is $s_i s_{i+1}\ldots s_k$.

  Example
   substring(3, s)
   substring(s, -10)
 SeeAlso
  lines
  separate
  "strings and nets"
  "regular expressions"
  utf8substring
///
doc ///
 Key
  utf8substring
 Headline
  extract part of a utf8 string
 Usage
  utf8substring(s, i, n)
 Inputs
  s:String
  i:ZZ
   starting index of substring
  n:ZZ
   length of substring
 Outputs
  :String
 Description
  Text
   Returns the substring of {\tt s} that starts at index
   {\tt i} and has {\tt n} characters, both measured in utf8 characters.
  Example
   s = "π ≈ 3.14159";
   utf8substring(s, 4, 4)
 SeeAlso
  substring
///