如何使用包含字符串' nav'的变量? (来自降价文件)而不是导航(json文件):
library(zoo)
as.vector(diff(zoo(v1), na.pad=TRUE))
#[1] NA 1 1 1 1 1 1 1 1 1
由于我有多个nav.json文件,如果我使用相应markdown文件中的变量,我希望它循环遍历各自的json文件,其文件名与markdown中的变量相同。
有任何帮助吗?
答案 0 :(得分:1)
首先,你的问题并不清楚你想要达到什么条件。
所以我想一次尝试,使用JavaScript数组变量就像你提到的语言数组的对象
function SendNeedHelpLinkTrace() {
var pLinkVirement = sessionStorage.getItem('pClickVirement'),
pLinkCarteBancaire = sessionStorage.getItem('pLinkCarteBancaire'),
pLinkRechargePaiementFactureTelecom = sessionStorage.getItem('pLinkRechargePaiementFactureTelecom'),
pPaiementVignetteImpotTaxe = sessionStorage.getItem('PaiementVignetteImpotTaxe'),
pLinkPaiementFactureEauElectricite = sessionStorage.getItem('pPaiementFactureEauElectricite'),
pLinkServiceFatourati = sessionStorage.getItem('pCatchLinkServiceFatourati'),
pLinkCihExpress = sessionStorage.getItem('pCatchLinkCihExpress'),
pLinkEdocuments = sessionStorage.getItem('pCatchLinkEdocuments'),
lChannelId = '01',
lServiceId = '900120',
lClientId = document.getElementById('<%= HiddenClientId.ClientID%>').value,
lData = pLinkVirement + ' | ' + pLinkCarteBancaire + ' | ' + pLinkRechargePaiementFactureTelecom + ' | ' + pPaiementVignetteImpotTaxe + ' | ' + pLinkPaiementFactureEauElectricite + ' | ' + pLinkServiceFatourati + ' | ' + pLinkCihExpress + ' | ' + pLinkEdocuments,
lDataCollectedString = lClientId + ';' + lChannelId + ';' + lServiceId + ';' + lData,
getLDataCollected = function(str) {
var str
.split(' || ')
.filter(function(item) {
return item !== 'Null';
})
.join(' || ');
};
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: 'http://localhost:9097/CatchEvent.asmx/CollectData',
data: JSON.stringify({
'pData': getLDataCollected(lDataCollectedString)
}),
dataType: 'json',
async: true,
success: function(data, textStatus) {
if (textStatus === 'success') {
alert('success');
}
},
error: function(exception) {
alert('Exeption:' + exception);
}
});
sessionStorage.clear();
}
所以结果会是
var language = ['english','marathi','hindhi','telugu'];
var result = [];
language.forEach(function(eachElement) {
// roam here if you want to do more .....
result.push('nav'+eachElement.charAt(0));
});
之后,在Handlerbar #each循环中使用此['nave','navm', 'navh', 'navt']
作为条件