Difference between revisions of "Set length"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
imported>Bale
m
 
Line 5: Line 5:
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=String Handling Routines|
 
  
 
function1={{Function|
 
function1={{Function|
Line 24: Line 23:
 
see_also={{SeeAlso|delete|insert|length}}|
 
see_also={{SeeAlso|delete|insert|length}}|
 
}}
 
}}
 +
 +
[[Category:String Handling Routines]]

Latest revision as of 05:13, 22 May 2010

needs(code_samples);

Function Syntax

void set_length(buffer original ,int length )

  • original is the buffer to modify
  • length is the new length of the buffer

Changes the size of the buffer. Primarily this is used to truncate the buffer by setting a new length shorter than the current length, deleting all the characters past that length. If the new length is longer than the old length, the buffer will be padded with null characters: \u0000. Those character can cause trouble, so only use set_length to truncate.

See Also

delete() | insert() | length()