Wiki

Changes between Initial Version and Version 1 of StringBuilder

Show
Ignore:
Timestamp:
08/19/09 09:31:05 (15 years ago)
Author:
Chuck
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StringBuilder

    v1 v1  
     1== StringBuilder == 
     2 
     3Cobra strings are immutable. To create something like a mutable string, use StringBuilder: 
     4{{{ 
     5#!python 
     6def visitMessage(url) as String 
     7    sb = StringBuilder() 
     8    sb.appendLine('Hello [.name],') 
     9    sb.appendLine('Please visit [ur].') 
     10    return sb.toString 
     11}}} 
     12 
     13If you would like to use newlines in your code, try `CobraCore.newLine` which returns the newline specific to the current platform such as '\n' or '\r\n': 
     14{{{ 
     15#!python 
     16def visitMessage(url) as String 
     17    nl = CobraCore.newLine 
     18    sb = StringBuilder() 
     19    sb.append('Hello [.name],[nl]') 
     20    sb.append('Please visit [ur].[nl]') 
     21    return sb.toString 
     22}}} 
     23 
     24For more information on the StringBuilder class, see [http://www.google.com/search?hl=en&q=C%23+stringbuilder Google(C# StringBuilder)] 
     25 
     26See also: LibraryTopics