Siebel VB Language Reference > Methods Reference for Siebel VB > String Methods >

Copy String Method


The Copy String method copies one string to another string or assigns a custom variable to another variable. It does not return a value. It copies values differently depending on the following:

  • The value in the string argument is shorter than the value in the string-expression argument. It copies the leftmost characters that the string-expression contains to the string that the string argument identifies. The number of characters it copies is equal to the length of the string argument.
  • The value in the string argument is longer than the value in the string-expression argument. It copies every character in the string-expression argument to the string that the string argument identifies, filling it from left to right. It replaces any leftover characters in the string argument with spaces.

You cannot use the Copy String method to assign variables of different custom types if one of these variables contains a variant or a variable-length string.

Format A

Lset string = string-expression

Format B

Lset variable1 = variable2

If you use format B, then the number of characters that this method copies is equal to the length of the shorter of variable1 and variable2.

Arguments

The following table describes the arguments that you can use with this method.

Argument
Description

string

A string variable or string expression to contain the copied characters.

string-expression

A string variable or string expression that contains the string that this method copies.

variable1

A variable in a custom type to contain the copied variable.

variable2

A variable that contains a custom type to be copied.

Example

The following example places a user last name into a variable. If the name is longer than the size of lastname, then it truncates the user name:

Sub Button_Click
   Dim lastname as String
   Dim strlast as String * 8
   lastname = "Smith"
   Lset strlast = lastname
   msgtext = "Your last name is: " & strlast
End Sub

Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.