我正在读取一个JSON文件,其中包含某些人的名称和图像URI。在结构上进行迭代时,我可以打印名称,但无法显示图像。我也看到了那个阵营不支持动态图像,所以我做了一个解决办法的建议在这里。
[
{
"id": 1,
"name": "Rohit",
"uri": "assets:/rohit.jpg",
"special": "text1"
},
{
"id": 2,
"name": "Anmol",
"uri": "assets:/rohit.jpg",
"special": "text2"
},
{
"id": 3,
"name": "Bhavya",
"uri": "assets:/rohit.jpg",
"special": "text3"
}
];
Run Code Online (Sandbox Code Playgroud)
import React, {Component} from 'react';
import { StyleSheet, Text, View, Image, ScrollView, Button, TouchableWithoutFeedback, TextInput, AsyncStorage} from 'react-native';
import { createStackNavigator } from 'react-navigation';
import customData1 from './customData.json';
class HomeScreen extends React.Component {
render() {
const initialArr = customData1;
return (
<View style={styles.container}> …Run Code Online (Sandbox Code Playgroud) 我正在使用逗号作为分隔符的文件.但是,它有一个字段,地址,其中地址是x,y,z形式,这会导致问题,因为地址的每个部分都有一个新的列条目.地址紧跟成员_no一个1位数字,如2等.Col1(地址),Col2(1位数)
text = '52A, XYZ Street, ABC District, 2'
Run Code Online (Sandbox Code Playgroud)
我基本上想从地址字段中删除该数字之前的所有逗号.
输出应该是这样的
52A XYZ Street ABC District, 2'
Run Code Online (Sandbox Code Playgroud)
我试过了
re.sub(r',', ' ', text)
Run Code Online (Sandbox Code Playgroud)
但它正在取代所有逗号实例.
我有一个包含三列的 HTML 表 - (姓名、年龄、城市)。我正在尝试实现类似“MS Excel”的功能,我可以在其中过滤多个列。
尽管过滤器是单独工作的,但当用户同时在多个输入字段中输入文本时,它们会发生故障。例如,仅输入名称即可正常工作,但输入名称和城市将完全排除名称过滤器。
function nameSearch() {
var input_name, input_age, input_city, filter, table, tr, td, i, txtValue_name, txtValue_age, txtValue_city;
input_name = document.getElementById("name-search");
input_age = document.getElementById("age-search");
input_city = document.getElementById("city-search");
filter_name = input_name.value.toUpperCase();
filter_age = input_age.value.toUpperCase();
filter_city = input_city.value.toUpperCase();
table = document.getElementById("custom-table");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td_name = tr[i].getElementsByTagName("td")[0];
if (td_name) {
txtValue_name = td_name.textContent || td_name.innerText;
if (txtValue_name.toUpperCase().indexOf(filter_name) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none"; …Run Code Online (Sandbox Code Playgroud)