home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2002 #3 / K-CD-3-2002.ISO / OpenOffice / f_0046 / sbasic.jar / text / sbasic / common / 03120304.xml < prev    next >
Encoding:
Extensible Markup Language  |  2001-09-07  |  3.2 KB  |  51 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>LSet Statement [Runtime]</title><meta name="filename" content="text/sbasic/common/03120304"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         p.P1{
  5.                 }
  6.         span.T1{
  7.                 font-weight:bold;}
  8.         </style></head><body>
  9.   
  10.   
  11.   <help:to-be-embedded Eid="lset" xmlns:help="http://openoffice.org/2000/help">
  12.   <p class="Head1"><help:link Id="66409">LSet Statement [Runtime]</help:link></p>
  13.   <p class="Paragraph">Aligns a string to the left of a string variable, or copies a variable of a user-defined type to another variable of a different user-defined type.</p>
  14.   </help:to-be-embedded>
  15.   <p class="Paragraph"><span class="T1">Syntax</span>:</p>
  16.   <p class="Paragraph">LSet Var As String = Text or LSet Var1 = Var2 <help:key-word value="LSet" tag="kw66409_1" xmlns:help="http://openoffice.org/2000/help"/></p>
  17.   <p class="Paragraph"><span class="T1">Parameter</span>:</p>
  18.   <p class="Paragraph">Var: Any String variable, in which the string to be aligned to the left.</p>
  19.   <p class="Paragraph">Text: String to be aligned to the left of the string variable.</p>
  20.   <p class="Paragraph">Var1: Name of the user-defined type variable being copied to.</p>
  21.   <p class="Paragraph">Var2: Name of the user-defined type variable being copied from.</p>
  22.   <p class="Paragraph">If the string is shorter than the string variable, <span class="T1">LSet</span> left-aligns the string within the string variable. Any remaining positions in the string variable are replaced by spaces. If the string is longer than the string variable, only the leftmost characters up to the length of the string variable are copied. With the <span class="T1">LSet</span> statement, you can also copy a user-defined type variable to another variable of the same type.</p>
  23.   <p class="Paragraph"><span class="T1">Example:</span></p>
  24.   <p class="PropText">Sub ExampleRLSet</p>
  25.   <p class="PropText">Dim sVar As String</p>
  26.   <p class="PropText">Dim sExpr As String</p>
  27.   <p class="PropText"/>
  28.   <p class="PropText">sVar = String(40,"*")</p>
  29.   <p class="PropText">sExpr = "SBX"</p>
  30.   <p class="PropText">REM Align "SBX" within the 40-character reference string</p>
  31.   <p class="PropText">REM Replace asterisks with spaces</p>
  32.   <p class="PropText">RSet sVar = sExpr</p>
  33.   <p class="PropText">Print ">"; sVar; "<"</p>
  34.   <p class="PropText"/>
  35.   <p class="PropText">sVar = String(5,"*")</p>
  36.   <p class="PropText">sExpr = "123457896"</p>
  37.   <p class="PropText">RSet sVar = sExpr</p>
  38.   <p class="PropText">Print ">"; sVar; "<"</p>
  39.   <p class="PropText"/>
  40.   <p class="PropText">sVar = String(40,"*")</p>
  41.   <p class="PropText">sExpr = "SBX"</p>
  42.   <p class="PropText">REM Left-align "SBX" within the 40-character reference string</p>
  43.   <p class="PropText">LSet sVar = sExpr</p>
  44.   <p class="PropText">Print ">"; sVar; "<"</p>
  45.   <p class="PropText"/>
  46.   <p class="PropText">sVar = String(5,"*")</p>
  47.   <p class="PropText">sExpr = "123456789"</p>
  48.   <p class="PropText">LSet sVar = sExpr</p>
  49.   <p class="PropText">Print ">"; sVar; "<"</p>
  50.   <p class="PropText">End Sub</p>
  51.  </body></html>