■ 事例

 ↑ TOP

$ jython
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26) 
[Java HotSpot(TM) Client VM (Apple Inc.)] on java1.5.0_13
Type "help", "copyright", "credits" or "license" for more information.
>>> # ---------------------------------------- StringBuilder
    
>>> >>> # ---------------------------------------- charAt >>> sb = StringBuilder("ABC"); sb ABC >>> for i in range(sb.length()): ... print("%d: %s"%(i, sb.charAt(i))) ... 0: A 1: B 2: C >>> # ---------------------------------------- indexOf >>> sb = StringBuilder("as happy as happy can be"); sb as happy as happy can be >>> >>> sb.indexOf('h') 3 >>> sb.indexOf("as") 0 >>> >>> sb.lastIndexOf('h') 12 >>> sb.lastIndexOf("as") 9 >>>

 ↑ TOP