Identifying last loop when using for each

后端 未结 25 1403
眼角桃花
眼角桃花 2020-12-08 09:59

I want to do something different with the last loop iteration when performing \'foreach\' on an object. I\'m using Ruby but the same goes for C#, Java etc.

          


        
25条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 10:04

    what are we thinking here?

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        String str = readIndex();
        String comp[] = str.split("}");
    
        StringBuffer sb = new StringBuffer();
        for (String s : comp) {
            sb.append(s);
            sb.append("}\n");
        }
        System.out.println (sb.toString());
    }
    

    As a modeling notation, the influence of the OMT notation dominates (e. g., using rectangles for classes and objects). Though the Booch "cloud" notation was dropped, the Booch capability to specify lower-level design detail was embraced. The use case notation from Objectory and the component notation from Booch were integrated with the rest of the notation, but the semantic integration was relatively weak in UML 1.1, and was not really fixed until the UML 2.0 major revision.

提交回复
热议问题