当前位置: 首页>>代码示例>>Python>>正文


Python String.lastIndexOf方法代码示例

本文整理汇总了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)
开发者ID:Paul-Nguyen,项目名称:mint,代码行数:10,代码来源:lookup.py

示例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
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:39,代码来源:tomcat_by_shell.py

示例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("\\"))
开发者ID:Rillanon,项目名称:ucmdb_10.01_CUP8_CP12_production_code_changes,代码行数:8,代码来源:Util.py

示例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):
开发者ID:crwulff,项目名称:zamiacad,代码行数:32,代码来源:ghdl.py

示例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("\\"))
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:7,代码来源:Util.py

示例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)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:7,代码来源:Util.py


注:本文中的java.lang.String.lastIndexOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。