File: ansi-utils.md

package info (click to toggle)
r-cran-cli 3.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,288 kB
  • sloc: ansic: 16,412; cpp: 37; sh: 13; makefile: 2
file content (161 lines) | stat: -rw-r--r-- 2,694 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# re_table

    Code
      tbl2
    Output
            start end   length                                
      text1 "19"  "23"  "5"    "\033[31m"                     
      text2 "27"  "31"  "5"    "\033[39m"                     
      text3 "48"  "52"  "5"    "\033[32m"                     
      text4 "58"  "62"  "5"    "\033[39m"                     
      text5 "74"  "98"  "25"   "\033]8;;https://example.com\a"
      text6 "103" "108" "6"    "\033]8;;\a"                   

---

    Code
      non_matching(list(tbl), txt)
    Output
      [[1]]
           start end length
      [1,]     1  18     18
      [2,]    24  26      3
      [3,]    32  47     16
      [4,]    53  57      5
      [5,]    63  73     11
      [6,]    99 102      4
      

# re_table special cases

    Code
      tbl
    Output
           start end length

---

    Code
      non_matching(list(tbl), txt)
    Output
      [[1]]
           start end length
      [1,]     1   6      6
      

---

    Code
      non_matching(list(tbl), txt, empty = TRUE)
    Output
      [[1]]
           start end length
      [1,]     1   6      6
      

---

    Code
      tbl
    Output
           start end length
      [1,]     1   5      5
      [2,]    12  16      5

---

    Code
      non_matching(list(tbl), txt)
    Output
      [[1]]
           start end length
      [1,]     6  11      6
      

---

    Code
      non_matching(list(tbl), txt, empty = TRUE)
    Output
      [[1]]
           start end length
      [1,]     1   0      0
      [2,]     6  11      6
      [3,]    17  16      0
      

---

    Code
      tbl
    Output
           start end length
      [1,]     5   9      5
      [2,]    10  14      5

---

    Code
      non_matching(list(tbl), txt)
    Output
      [[1]]
           start end length
      [1,]     1   4      4
      [2,]    15  18      4
      

---

    Code
      non_matching(list(tbl), txt, empty = TRUE)
    Output
      [[1]]
           start end length
      [1,]     1   4      4
      [2,]    10   9      0
      [3,]    15  18      4
      

# myseq

    Code
      myseq(1, 5)
    Output
      [1] 1 2 3 4 5
    Code
      myseq(1, 1)
    Output
      [1] 1
    Code
      myseq(1, 0)
    Output
      integer(0)
    Code
      myseq(1, 5, 2)
    Output
      [1] 1 3 5
    Code
      myseq(1, 6, 2)
    Output
      [1] 1 3 5
    Code
      myseq(1, 1, 2)
    Output
      [1] 1
    Code
      myseq(1, 2, -1)
    Output
      integer(0)
    Code
      myseq(10, 1, -1)
    Output
       [1] 10  9  8  7  6  5  4  3  2  1
    Code
      myseq(10, 1, -2)
    Output
      [1] 10  8  6  4  2
    Code
      myseq(1, 5, -2)
    Output
      integer(0)