本文整理汇总了Python中java.lang.String.lastIndexOf方法的典型用法代码示例。如果您正苦于以下问题:Python String.lastIndexOf方法的具体用法?Python String.lastIndexOf怎么用?Python String.lastIndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.String
的用法示例。
在下文中一共展示了String.lastIndexOf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sortResultsByCode
# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import lastIndexOf [as 别名]
def sortResultsByCode(self):
tempMap = HashMap()
for result in self.__results:
uri = String(self.getValue(result, "dc_identifier"))
lastIndex = uri.lastIndexOf('/') + 1
code = uri.substring(lastIndex)
tempMap.put(code, result)
self.resultsByCode = TreeMap(tempMap)
示例2: loadXmlFile
# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import lastIndexOf [as 别名]
def loadXmlFile(self, path, container = None, fileContent = None):
'str, osh, str -> Document'
saxBuilder = SAXBuilder()
globalSettings = GeneralSettingsConfigFile.getInstance()
#loadExternalDTD = globalSettings.getPropertyBooleanValue('loadExternalDTD', 1)
loadExternalDTD = 1
saxBuilder.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", loadExternalDTD)
logger.debug("loadXmlFile, loadExternalDTD: ", loadExternalDTD, ", path: ", path )
if loadExternalDTD :
saxBuilder.setEntityResolver( XMLExternalEntityResolver( self.fileMonitor, str(path), self.shellUtils ) )
saxBuilder.setFeature("http://xml.org/sax/features/use-entity-resolver2", 1)
doc = None
try:
fileContent = fileContent or self.fileMonitor.getFileContent(path)
if fileContent:
try:
strContent = String(fileContent)
strContent = String(strContent.substring(0, strContent.lastIndexOf('>') + 1))
doc = saxBuilder.build(ByteArrayInputStream(strContent.getBytes()))
if container is not None:
cfOSH = self.createCF(container, path, fileContent)
if cfOSH is not None:
self.OSHVResult.add(cfOSH)
except:
logger.debugException('Failed to load xml file:', path)
excMsg = traceback.format_exc()
logger.debug( excMsg )
except:
logger.debugException('Failed to get content of file:', path)
excMsg = traceback.format_exc()
logger.debug( excMsg )
return doc
示例3: getPath
# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import lastIndexOf [as 别名]
def getPath(path):
ss = String(path)
if(ss.indexOf("\\")==-1):
# return ss
return path # changed by Daniel La - HP Case 4644803487
return ss.substring(0,ss.lastIndexOf("\\"))
示例4: cl
# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import lastIndexOf [as 别名]
from subprocess import call, Popen, PIPE
import re
from java.lang import String
def cl(cmd):
call(cmd, shell=True)
pattern = re.compile(r"([^:]*):([0-9]+):([0-9]+):(.*)$")
name = String(sourceFile.getName())
shName = name.substring(0, name.lastIndexOf(".vhd"))
parent = sourceFile.getParent()
os.chdir(parent)
cl("rm -rf work")
cl("mkdir work")
process = Popen(["ghdl", "-i", "--work=work", "--workdir=work", str(name)], stdout=PIPE)
marker_clean(sourceFileFullPath)
process = Popen(["ghdl", "-m", "--ieee=synopsys", "-fexplicit", "--workdir=work", "-Pwork", str(shName)], stderr=PIPE, stdout=PIPE)
out = process.stdout.read()
err = process.stderr.read()
for line in re.split("\n+", out):
if line:
printf(line)
for line in re.split("\n+", err):
示例5: getPath
# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import lastIndexOf [as 别名]
def getPath(path):
ss = String(path)
if(ss.indexOf("\\")==-1):
return path
return ss.substring(0,ss.lastIndexOf("\\"))
示例6: getFileFromPath
# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import lastIndexOf [as 别名]
def getFileFromPath(path):
ss = String(path)
if(ss.indexOf("\\")==-1):
return path
return ss.substring(ss.lastIndexOf("\\")+1)