Changeset 1588

Show
Ignore:
Timestamp:
08/19/08 06:52:09 (3 months ago)
Author:
Chuck.Esterbrook
Message:

Code cleanup.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/Utils.cobra

    r1584 r1588  
    99extend String 
    1010 
    11 /# 
    12         CC: parser error, this won''t fly: 
    1311        def capped as String 
    1412                """ 
     
    1614                Returns a blank string for a blank string. 
    1715                """ 
    18 #               CC: contracts on extension methods 
    19 #               ensure 
    20 #                       result.length == .length 
    21 #                       result.length implies result[0] == result[0].toUpper 
     16                ensure 
     17                        result.length == .length 
     18                        result.length implies result[0] == result[0].toUpper 
    2219                test 
    2320                        assert 'chuck'.capped == 'Chuck' 
     
    3027                        if .length == 0, return this 
    3128                        return this[0:1].toUpper + this[1:] 
    32 #/ 
    33  
    34         def capped as String 
    35                 """ 
    36                 Returns the string with the first character capitalized. 
    37                 Returns a blank string for a blank string. 
    38                 """ 
    39                 test 
    40                         assert 'chuck'.capped == 'Chuck' 
    41                         assert 'Chuck'.capped == 'Chuck' 
    42                         assert ''.capped == '' 
    43                         assert ' foo'.capped == ' foo' 
    44                         assert 'f'.capped == 'F' 
    45                         assert '1aoeu'.capped == '1aoeu' 
    46                 body 
    47                         if .length == 0, return this 
    48                         return this[0:1].toUpper + this[1:] 
     29 
    4930 
    5031class Utils