sj字符串截取身份证号第17位
时间: 2023-10-11 22:08:32 浏览: 50
要截取身份证号码的第17位字符,你可以使用以下代码:
```python
id_number = "110101199001011234" # 替换为你的身份证号码
seventeenth_char = id_number[16]
print(seventeenth_char)
```
这段代码中,我们假设身份证号码是"110101199001011234",通过索引`[16]`来获取第17位字符。请替换`id_number`变量的值为你的身份证号码。运行代码后,会输出第17位字符。
相关问题
js 截取字符串第一个字符
要截取字符串的第一个字符,可以使用字符串的 `charAt` 方法或者数组的索引方式来获取。
使用 `charAt` 方法:
```js
const str = 'hello';
const firstChar = str.charAt(0); // 'h'
```
使用数组的索引方式:
```js
const str = 'hello';
const firstChar = str[0]; // 'h'
```
两种方式都可以获取字符串的第一个字符。
js 数组的第一位 push 一个字符串
可以这样实现:arrayName.unshift("string")。其中,arrayName是指定数组的名称,"string"是要添加的字符串。这个方法会在数组的开头添加一个新元素,并将已有元素向后移动。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)