【问题标题】:String.contains() in Flex?Flex中的String.contains()?
【发布时间】:2014-12-16 20:24:06
【问题描述】:

你知道 Flex 有没有像 Contains() 这样的方法在字符串中查找单词吗???

我想做这样的事情:

       for (int x = 0; x < Concepto.length; x++) {
        if(cadena.contains(id[x])){

            System.out.println("ID ya agregado...");
        }
        else{
            cadena += "\n id=  " + id[x];
        }
        for (int y = 0; y < Concepto.length; y++) {



            if (id[x].equals(id[y])) {
            if(cadena.contains(Concepto[y])){
                    System.out.println("Concepto ya agregado...");
            }else{
                cadena += "\n" + Concepto[y];
            }

            }else {
                System.out.println("No se agrega...");
            }


        }

【问题讨论】:

    标签: string actionscript-3 apache-flex flash-builder contains


    【解决方案1】:

    使用indexOf方法

    if(cadena.indexOf(Concepto[y]) > -1)
    

    【讨论】:

      猜你喜欢
      • 2010-11-06
      • 1970-01-01
      • 2014-01-30
      • 2016-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-14
      相关资源
      最近更新 更多