Sdílet prostřednictvím


AbstractStringBuilder.SetLength(Int32) Method

Definition

Sets the length of the character sequence.

[Android.Runtime.Register("setLength", "(I)V", "GetSetLength_IHandler")]
public virtual void SetLength (int newLength);
[<Android.Runtime.Register("setLength", "(I)V", "GetSetLength_IHandler")>]
abstract member SetLength : int -> unit
override this.SetLength : int -> unit

Parameters

newLength
Int32

the new length

Attributes

Remarks

Sets the length of the character sequence. The sequence is changed to a new character sequence whose length is specified by the argument. For every nonnegative index k less than newLength, the character at index k in the new character sequence is the same as the character at index k in the old sequence if k is less than the length of the old character sequence; otherwise, it is the null character '\u005Cu0000'.

In other words, if the newLength argument is less than the current length, the length is changed to the specified length.

If the newLength argument is greater than or equal to the current length, sufficient null characters ('\u005Cu0000') are appended so that length becomes the newLength argument.

The newLength argument must be greater than or equal to 0.

Java documentation for java.lang.AbstractStringBuilder.setLength(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to