我需要在数组中找到单词的索引.但是对于以下场景
var str="hello how are you r u fineOr not .Why u r not fine.Please tell wats makes u notfiness".
var splitStr=str.split(" ");
//in splitStr array fineOr is stored at da index of 6.
//in splitStr array notfiness is stored at da index of 18.
var i=splitStr.indexOf("**fine**");
var k=splitStr.lastindexOf("**fine**");
console.log('value i-- '+i); it should log value 6
console.log('value k-- '+k); it should log value 18
Run Code Online (Sandbox Code Playgroud)
我如何传递正则表达式来搜索字符串"fine"以获取数组的函数indexOf?
与sqlalchemy在金字塔上工作:
newjob_obj=Job(name=name,job_propery=job_property,sizeX=sizeX,
sizeY=sizeY,quantity=quantity,timeline=timeline,
description=description,remarks=remarks,
client_id=client_id,created_by=created_by,status=status
)
new_job=session.add(newjob_obj)
print('Return newJob value %s\n' % new_job)
Run Code Online (Sandbox Code Playgroud)
这里new_job正在打印None.添加会话功能返回对象与否.请帮忙.