istr-python 1.1.44__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {istr_python-1.1.44 → istr_python-1.2.0}/PKG-INFO +63 -87
- {istr_python-1.1.44 → istr_python-1.2.0}/README.md +62 -86
- {istr_python-1.1.44 → istr_python-1.2.0}/istr/istr.py +101 -268
- {istr_python-1.1.44 → istr_python-1.2.0}/istr_python.egg-info/PKG-INFO +63 -87
- {istr_python-1.1.44 → istr_python-1.2.0}/pyproject.toml +1 -1
- {istr_python-1.1.44 → istr_python-1.2.0}/tests/test_istr.py +109 -188
- {istr_python-1.1.44 → istr_python-1.2.0}/istr/LICENSE.txt +0 -0
- {istr_python-1.1.44 → istr_python-1.2.0}/istr/__init__.py +0 -0
- {istr_python-1.1.44 → istr_python-1.2.0}/istr_python.egg-info/SOURCES.txt +0 -0
- {istr_python-1.1.44 → istr_python-1.2.0}/istr_python.egg-info/dependency_links.txt +0 -0
- {istr_python-1.1.44 → istr_python-1.2.0}/istr_python.egg-info/top_level.txt +0 -0
- {istr_python-1.1.44 → istr_python-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: istr-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: istr - strings you can count on
|
|
5
5
|
Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/salabim/istr
|
|
@@ -339,17 +339,16 @@ several other types:
|
|
|
339
339
|
istr({0, 1, 4}) ==> {istr('4'), istr('0'), istr('1')} # or similar
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
- if a range,
|
|
342
|
+
- if a range, a generator that yields istr-s will be returned
|
|
343
343
|
|
|
344
344
|
```
|
|
345
|
-
istr(range(3)) ==> istr
|
|
346
|
-
|
|
347
|
-
len(istr(range(3))) ==> 3
|
|
345
|
+
list(istr(range(3))) ==> [istr('0', istr('1', istr('2')]
|
|
346
|
+
|
|
348
347
|
```
|
|
349
348
|
|
|
350
|
-
- if an istr.range instance, the
|
|
349
|
+
- if an istr.range instance, the generator will be propagated
|
|
351
350
|
```
|
|
352
|
-
istr(istr.range(
|
|
351
|
+
list(istr(istr.range(3))) ==> [istr('0', istr('1', istr('2')]
|
|
353
352
|
```
|
|
354
353
|
|
|
355
354
|
|
|
@@ -370,14 +369,29 @@ a, b, c = istr(*range(3)) ==> a=istr('0') , b=istr('1'), c=istr('2')
|
|
|
370
369
|
```
|
|
371
370
|
#### Alternative way of range specification
|
|
372
371
|
|
|
373
|
-
Instead of `istr(range(..))` it is possible to use `istr
|
|
372
|
+
Instead of `istr(range(..))` it is possible to use `istr.range(..)` instead, like
|
|
374
373
|
|
|
375
374
|
`list(istr.range(3,6))` ==> `[istr('3'), istr('4'), istr('5')]`
|
|
376
375
|
|
|
377
|
-
In contrast to the builtin `range`, `istr.range` supports a
|
|
376
|
+
In contrast to the builtin `range`, `istr.range` supports a keyword parameter `length`:
|
|
378
377
|
|
|
379
378
|
`list(istr.range(length=3))` is equivalent to `istr.range(100, 1000)`
|
|
380
379
|
|
|
380
|
+
On top of this, `istr.range` support a keyword parameter `distinct`, to return a generator that yields only numbers with distinct numbers:
|
|
381
|
+
|
|
382
|
+
`list(istr.range(98,104,distinct=True))` is `[istr('98'), istr('102'), istr('103')]`
|
|
383
|
+
|
|
384
|
+
For `istr.range(length=..., distict=True)` the generation is optimized (not just checking each possible value).
|
|
385
|
+
|
|
386
|
+
It is also possible to specify an exclude parameter, with which any generated value will be discarded if it contains a character in exclude. E.g:
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
for i in istr.range(length=5, distinct=True):
|
|
390
|
+
if ...:
|
|
391
|
+
for j in istr.range(length=2, distinct=True, exclude=i):
|
|
392
|
+
...
|
|
393
|
+
```
|
|
394
|
+
|
|
381
395
|
#### square root, cubic root and nth root
|
|
382
396
|
The methods `sqrt`, `cbrt`, `nth_root`provide the square root, cubic root and nth root of an istr. If there is no integer root, the fallback value (default `istr('0')` will be returned.
|
|
383
397
|
```
|
|
@@ -547,15 +561,15 @@ istr.divisors(18, False) ==> [istr('1'), istr('18'), istr('2'), istr('9'), istr(
|
|
|
547
561
|
|
|
548
562
|
#### test whether all characters are distinct
|
|
549
563
|
|
|
550
|
-
With the `
|
|
564
|
+
With the `is_distinct` method, it is possible to test whether all characters are distinct (i.e. no character appears more than once).
|
|
551
565
|
|
|
552
566
|
```
|
|
553
|
-
istr('01234').
|
|
554
|
-
istr('012340').
|
|
567
|
+
istr('01234').is_distict() ==> True
|
|
568
|
+
istr('012340').is_distict() ==> False
|
|
555
569
|
n98 = istr(98)
|
|
556
570
|
n100 = n98 + 2
|
|
557
|
-
istr(n98).
|
|
558
|
-
istr(n100).
|
|
571
|
+
istr(n98).is_distinct() ==> True
|
|
572
|
+
istr(n100).is_distinct() ==> False
|
|
559
573
|
```
|
|
560
574
|
#### test if characters are consecutive
|
|
561
575
|
|
|
@@ -824,8 +838,17 @@ Alternatively, it is possible to get a list of all squares, cubes, power_ofs or
|
|
|
824
838
|
|
|
825
839
|
`istr.squares (length=2)` returns a list of all squares of length 2, so between 10 and 99.
|
|
826
840
|
|
|
841
|
+
If the keyword `distinct` is True, all values that are not distinct, will be excluded, like:
|
|
842
|
+
|
|
843
|
+
`list(istr.primes(list(istr.primes(100,132,distinct=True))` is `[istr('103'), istr('107'), istr('109'), istr('127')]`, thus leaving out 101, 113 and 131
|
|
844
|
+
|
|
827
845
|
Unless `cache=False` is specified, the query result is cached.
|
|
828
846
|
|
|
847
|
+
#### filter distinct_only
|
|
848
|
+
|
|
849
|
+
With `istr.distinct_only` any iterable can skip values that are not distinct:
|
|
850
|
+
`list(istr.distinct_only([10, 11, 100, 123, 'abc', 'aaa']))` is `[istr('10'), istr('123'), istr('abc')]`
|
|
851
|
+
|
|
829
852
|
#### Safe indexing (getitem)
|
|
830
853
|
|
|
831
854
|
The `istr.getitem` method is essentially, a safe version of indexing an istr.
|
|
@@ -1127,11 +1150,8 @@ This will print
|
|
|
1127
1150
|
?
|
|
1128
1151
|
```
|
|
1129
1152
|
|
|
1130
|
-
##### Note
|
|
1131
1153
|
>
|
|
1132
|
-
>
|
|
1133
|
-
|
|
1134
|
-
It is also possible to set the repr mode without a context manager:
|
|
1154
|
+
> It is also possible to set the repr mode without a context manager:
|
|
1135
1155
|
|
|
1136
1156
|
```
|
|
1137
1157
|
istr.repr_mode('str')
|
|
@@ -1148,48 +1168,6 @@ print(repr(istr.repr_mode()))
|
|
|
1148
1168
|
```
|
|
1149
1169
|
will output `istr`.
|
|
1150
1170
|
|
|
1151
|
-
#### Changing the base system
|
|
1152
|
-
|
|
1153
|
-
By default, `istr` works in base 10. However it is possible to change the base system with the `istr.base()` context manager / method.
|
|
1154
|
-
|
|
1155
|
-
Any base between 2 and 36 may be used.
|
|
1156
|
-
|
|
1157
|
-
Note that the integer is **always** stored in base 10 mode, but the string
|
|
1158
|
-
representation will reflect the chosen base (at time of initialization).
|
|
1159
|
-
|
|
1160
|
-
Some examples:
|
|
1161
|
-
```
|
|
1162
|
-
with istr.base(16):
|
|
1163
|
-
a = istr('7fff')
|
|
1164
|
-
print(int(a))
|
|
1165
|
-
|
|
1166
|
-
b = istr(127)
|
|
1167
|
-
print(repr(b))
|
|
1168
|
-
```
|
|
1169
|
-
This will result in
|
|
1170
|
-
```
|
|
1171
|
-
32767
|
|
1172
|
-
istr('7F')
|
|
1173
|
-
```
|
|
1174
|
-
All calculations are done in the decimal 10 base system.
|
|
1175
|
-
|
|
1176
|
-
Note that the way an `istr` is interpreted is determined at initialization.
|
|
1177
|
-
|
|
1178
|
-
It is also possible to set the repr mode without a context manager:
|
|
1179
|
-
```
|
|
1180
|
-
istr.base(16)
|
|
1181
|
-
print(int(istr('7fff')))
|
|
1182
|
-
```
|
|
1183
|
-
This will print
|
|
1184
|
-
```
|
|
1185
|
-
32767
|
|
1186
|
-
```
|
|
1187
|
-
Finally, the current base can be queried with `istr.base()`, so upon start:
|
|
1188
|
-
```
|
|
1189
|
-
print(istr.base())
|
|
1190
|
-
```
|
|
1191
|
-
will result in `10`.
|
|
1192
|
-
|
|
1193
1171
|
#### Changing the format of the string
|
|
1194
1172
|
|
|
1195
1173
|
When an istr is initialized with a string the istr will be always stored as such.
|
|
@@ -1240,9 +1218,8 @@ istr('123')
|
|
|
1240
1218
|
istr('1234')
|
|
1241
1219
|
```
|
|
1242
1220
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
> For bases other than 10, the string will never be reformatted!
|
|
1221
|
+
|
|
1222
|
+
|
|
1246
1223
|
|
|
1247
1224
|
### Overview of operations
|
|
1248
1225
|
|
|
@@ -1254,32 +1231,31 @@ operator/function int str Example
|
|
|
1254
1231
|
+ x istr(20) + 3 ==> istr('23')
|
|
1255
1232
|
_ x istr(20) - 3 ==> istr('17')
|
|
1256
1233
|
* x istr(20) * 3 ==> istr('60')
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
istr.count(100) ==> istr('100'), istr('101').
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1234
|
+
/ x istr(20) / 3 ==> istr('6')
|
|
1235
|
+
// x istr(20) // 3 ==> istr('6')
|
|
1236
|
+
% x istr(20) % 3 ==> istr('2')
|
|
1237
|
+
divmod x divmod(istr(20), 3) ==> (istr('6'), istr('2'))
|
|
1238
|
+
** x istr(2) ** 3 ==> istr('8')
|
|
1239
|
+
<=, <, >, >= x istr('100') > istr('2') ==> True
|
|
1240
|
+
abs x abs(istr(-20)) ==> istr('20')
|
|
1241
|
+
int x int(istr("20")) ==> 20
|
|
1242
|
+
float x float(istr("20")) ==> 20.0
|
|
1243
|
+
complex x complex(istr("20")) ==> (20+0j)
|
|
1244
|
+
== x x istr(20) == 20 ==> True | istr(20) == '20' ==> True
|
|
1245
|
+
bool x x *) bool(istr(' 0 ')) ==> False | bool(istr('')) ==> False
|
|
1246
|
+
@ x istr(20) @ 3 ==> istr('202020')
|
|
1247
|
+
| x istr(20) | '5' ==> istr('205')
|
|
1248
|
+
slicing x istr(12345)[1:3] ==> istr('23')
|
|
1249
|
+
iterate x [x for x in istr(20)] ==> [istr('2'), istr('0')]
|
|
1250
|
+
len x len(istr(' 20 ')) ==> 4
|
|
1251
|
+
count x istr(100).count(0) ==> 2
|
|
1252
|
+
istr.count(100) ==> istr('100'), istr('101'). ...
|
|
1253
|
+
index x istr(' 100 ').index('0') ==> 2
|
|
1254
|
+
split x istr('1 2').split() ==> (istr('1'), istr('2'))
|
|
1255
|
+
string format x f"|{istr(1234):6}|" ==> '|1234 |'
|
|
1256
|
+
other string methods x istr('aAbBcC').lower() ==> istr('aabbcc')
|
|
1280
1257
|
istr('aAbBcC').islower() ==> False
|
|
1281
1258
|
istr(' abc ').strip() ==> istr('abc')
|
|
1282
|
-
...
|
|
1283
1259
|
-----------------------------------------------------------------------------------------
|
|
1284
1260
|
*) str is applied if is_int() is False
|
|
1285
1261
|
```
|
|
@@ -326,17 +326,16 @@ several other types:
|
|
|
326
326
|
istr({0, 1, 4}) ==> {istr('4'), istr('0'), istr('1')} # or similar
|
|
327
327
|
```
|
|
328
328
|
|
|
329
|
-
- if a range,
|
|
329
|
+
- if a range, a generator that yields istr-s will be returned
|
|
330
330
|
|
|
331
331
|
```
|
|
332
|
-
istr(range(3)) ==> istr
|
|
333
|
-
|
|
334
|
-
len(istr(range(3))) ==> 3
|
|
332
|
+
list(istr(range(3))) ==> [istr('0', istr('1', istr('2')]
|
|
333
|
+
|
|
335
334
|
```
|
|
336
335
|
|
|
337
|
-
- if an istr.range instance, the
|
|
336
|
+
- if an istr.range instance, the generator will be propagated
|
|
338
337
|
```
|
|
339
|
-
istr(istr.range(
|
|
338
|
+
list(istr(istr.range(3))) ==> [istr('0', istr('1', istr('2')]
|
|
340
339
|
```
|
|
341
340
|
|
|
342
341
|
|
|
@@ -357,14 +356,29 @@ a, b, c = istr(*range(3)) ==> a=istr('0') , b=istr('1'), c=istr('2')
|
|
|
357
356
|
```
|
|
358
357
|
#### Alternative way of range specification
|
|
359
358
|
|
|
360
|
-
Instead of `istr(range(..))` it is possible to use `istr
|
|
359
|
+
Instead of `istr(range(..))` it is possible to use `istr.range(..)` instead, like
|
|
361
360
|
|
|
362
361
|
`list(istr.range(3,6))` ==> `[istr('3'), istr('4'), istr('5')]`
|
|
363
362
|
|
|
364
|
-
In contrast to the builtin `range`, `istr.range` supports a
|
|
363
|
+
In contrast to the builtin `range`, `istr.range` supports a keyword parameter `length`:
|
|
365
364
|
|
|
366
365
|
`list(istr.range(length=3))` is equivalent to `istr.range(100, 1000)`
|
|
367
366
|
|
|
367
|
+
On top of this, `istr.range` support a keyword parameter `distinct`, to return a generator that yields only numbers with distinct numbers:
|
|
368
|
+
|
|
369
|
+
`list(istr.range(98,104,distinct=True))` is `[istr('98'), istr('102'), istr('103')]`
|
|
370
|
+
|
|
371
|
+
For `istr.range(length=..., distict=True)` the generation is optimized (not just checking each possible value).
|
|
372
|
+
|
|
373
|
+
It is also possible to specify an exclude parameter, with which any generated value will be discarded if it contains a character in exclude. E.g:
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
for i in istr.range(length=5, distinct=True):
|
|
377
|
+
if ...:
|
|
378
|
+
for j in istr.range(length=2, distinct=True, exclude=i):
|
|
379
|
+
...
|
|
380
|
+
```
|
|
381
|
+
|
|
368
382
|
#### square root, cubic root and nth root
|
|
369
383
|
The methods `sqrt`, `cbrt`, `nth_root`provide the square root, cubic root and nth root of an istr. If there is no integer root, the fallback value (default `istr('0')` will be returned.
|
|
370
384
|
```
|
|
@@ -534,15 +548,15 @@ istr.divisors(18, False) ==> [istr('1'), istr('18'), istr('2'), istr('9'), istr(
|
|
|
534
548
|
|
|
535
549
|
#### test whether all characters are distinct
|
|
536
550
|
|
|
537
|
-
With the `
|
|
551
|
+
With the `is_distinct` method, it is possible to test whether all characters are distinct (i.e. no character appears more than once).
|
|
538
552
|
|
|
539
553
|
```
|
|
540
|
-
istr('01234').
|
|
541
|
-
istr('012340').
|
|
554
|
+
istr('01234').is_distict() ==> True
|
|
555
|
+
istr('012340').is_distict() ==> False
|
|
542
556
|
n98 = istr(98)
|
|
543
557
|
n100 = n98 + 2
|
|
544
|
-
istr(n98).
|
|
545
|
-
istr(n100).
|
|
558
|
+
istr(n98).is_distinct() ==> True
|
|
559
|
+
istr(n100).is_distinct() ==> False
|
|
546
560
|
```
|
|
547
561
|
#### test if characters are consecutive
|
|
548
562
|
|
|
@@ -811,8 +825,17 @@ Alternatively, it is possible to get a list of all squares, cubes, power_ofs or
|
|
|
811
825
|
|
|
812
826
|
`istr.squares (length=2)` returns a list of all squares of length 2, so between 10 and 99.
|
|
813
827
|
|
|
828
|
+
If the keyword `distinct` is True, all values that are not distinct, will be excluded, like:
|
|
829
|
+
|
|
830
|
+
`list(istr.primes(list(istr.primes(100,132,distinct=True))` is `[istr('103'), istr('107'), istr('109'), istr('127')]`, thus leaving out 101, 113 and 131
|
|
831
|
+
|
|
814
832
|
Unless `cache=False` is specified, the query result is cached.
|
|
815
833
|
|
|
834
|
+
#### filter distinct_only
|
|
835
|
+
|
|
836
|
+
With `istr.distinct_only` any iterable can skip values that are not distinct:
|
|
837
|
+
`list(istr.distinct_only([10, 11, 100, 123, 'abc', 'aaa']))` is `[istr('10'), istr('123'), istr('abc')]`
|
|
838
|
+
|
|
816
839
|
#### Safe indexing (getitem)
|
|
817
840
|
|
|
818
841
|
The `istr.getitem` method is essentially, a safe version of indexing an istr.
|
|
@@ -1114,11 +1137,8 @@ This will print
|
|
|
1114
1137
|
?
|
|
1115
1138
|
```
|
|
1116
1139
|
|
|
1117
|
-
##### Note
|
|
1118
1140
|
>
|
|
1119
|
-
>
|
|
1120
|
-
|
|
1121
|
-
It is also possible to set the repr mode without a context manager:
|
|
1141
|
+
> It is also possible to set the repr mode without a context manager:
|
|
1122
1142
|
|
|
1123
1143
|
```
|
|
1124
1144
|
istr.repr_mode('str')
|
|
@@ -1135,48 +1155,6 @@ print(repr(istr.repr_mode()))
|
|
|
1135
1155
|
```
|
|
1136
1156
|
will output `istr`.
|
|
1137
1157
|
|
|
1138
|
-
#### Changing the base system
|
|
1139
|
-
|
|
1140
|
-
By default, `istr` works in base 10. However it is possible to change the base system with the `istr.base()` context manager / method.
|
|
1141
|
-
|
|
1142
|
-
Any base between 2 and 36 may be used.
|
|
1143
|
-
|
|
1144
|
-
Note that the integer is **always** stored in base 10 mode, but the string
|
|
1145
|
-
representation will reflect the chosen base (at time of initialization).
|
|
1146
|
-
|
|
1147
|
-
Some examples:
|
|
1148
|
-
```
|
|
1149
|
-
with istr.base(16):
|
|
1150
|
-
a = istr('7fff')
|
|
1151
|
-
print(int(a))
|
|
1152
|
-
|
|
1153
|
-
b = istr(127)
|
|
1154
|
-
print(repr(b))
|
|
1155
|
-
```
|
|
1156
|
-
This will result in
|
|
1157
|
-
```
|
|
1158
|
-
32767
|
|
1159
|
-
istr('7F')
|
|
1160
|
-
```
|
|
1161
|
-
All calculations are done in the decimal 10 base system.
|
|
1162
|
-
|
|
1163
|
-
Note that the way an `istr` is interpreted is determined at initialization.
|
|
1164
|
-
|
|
1165
|
-
It is also possible to set the repr mode without a context manager:
|
|
1166
|
-
```
|
|
1167
|
-
istr.base(16)
|
|
1168
|
-
print(int(istr('7fff')))
|
|
1169
|
-
```
|
|
1170
|
-
This will print
|
|
1171
|
-
```
|
|
1172
|
-
32767
|
|
1173
|
-
```
|
|
1174
|
-
Finally, the current base can be queried with `istr.base()`, so upon start:
|
|
1175
|
-
```
|
|
1176
|
-
print(istr.base())
|
|
1177
|
-
```
|
|
1178
|
-
will result in `10`.
|
|
1179
|
-
|
|
1180
1158
|
#### Changing the format of the string
|
|
1181
1159
|
|
|
1182
1160
|
When an istr is initialized with a string the istr will be always stored as such.
|
|
@@ -1227,9 +1205,8 @@ istr('123')
|
|
|
1227
1205
|
istr('1234')
|
|
1228
1206
|
```
|
|
1229
1207
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
> For bases other than 10, the string will never be reformatted!
|
|
1208
|
+
|
|
1209
|
+
|
|
1233
1210
|
|
|
1234
1211
|
### Overview of operations
|
|
1235
1212
|
|
|
@@ -1241,32 +1218,31 @@ operator/function int str Example
|
|
|
1241
1218
|
+ x istr(20) + 3 ==> istr('23')
|
|
1242
1219
|
_ x istr(20) - 3 ==> istr('17')
|
|
1243
1220
|
* x istr(20) * 3 ==> istr('60')
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
istr.count(100) ==> istr('100'), istr('101').
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1221
|
+
/ x istr(20) / 3 ==> istr('6')
|
|
1222
|
+
// x istr(20) // 3 ==> istr('6')
|
|
1223
|
+
% x istr(20) % 3 ==> istr('2')
|
|
1224
|
+
divmod x divmod(istr(20), 3) ==> (istr('6'), istr('2'))
|
|
1225
|
+
** x istr(2) ** 3 ==> istr('8')
|
|
1226
|
+
<=, <, >, >= x istr('100') > istr('2') ==> True
|
|
1227
|
+
abs x abs(istr(-20)) ==> istr('20')
|
|
1228
|
+
int x int(istr("20")) ==> 20
|
|
1229
|
+
float x float(istr("20")) ==> 20.0
|
|
1230
|
+
complex x complex(istr("20")) ==> (20+0j)
|
|
1231
|
+
== x x istr(20) == 20 ==> True | istr(20) == '20' ==> True
|
|
1232
|
+
bool x x *) bool(istr(' 0 ')) ==> False | bool(istr('')) ==> False
|
|
1233
|
+
@ x istr(20) @ 3 ==> istr('202020')
|
|
1234
|
+
| x istr(20) | '5' ==> istr('205')
|
|
1235
|
+
slicing x istr(12345)[1:3] ==> istr('23')
|
|
1236
|
+
iterate x [x for x in istr(20)] ==> [istr('2'), istr('0')]
|
|
1237
|
+
len x len(istr(' 20 ')) ==> 4
|
|
1238
|
+
count x istr(100).count(0) ==> 2
|
|
1239
|
+
istr.count(100) ==> istr('100'), istr('101'). ...
|
|
1240
|
+
index x istr(' 100 ').index('0') ==> 2
|
|
1241
|
+
split x istr('1 2').split() ==> (istr('1'), istr('2'))
|
|
1242
|
+
string format x f"|{istr(1234):6}|" ==> '|1234 |'
|
|
1243
|
+
other string methods x istr('aAbBcC').lower() ==> istr('aabbcc')
|
|
1267
1244
|
istr('aAbBcC').islower() ==> False
|
|
1268
1245
|
istr(' abc ').strip() ==> istr('abc')
|
|
1269
|
-
...
|
|
1270
1246
|
-----------------------------------------------------------------------------------------
|
|
1271
1247
|
*) str is applied if is_int() is False
|
|
1272
1248
|
```
|