LSet Statement

๋ฌธ์ž์—ด์„ ๋ฌธ์ž์—ด ๋ณ€์ˆ˜์˜ ์™ผ์ชฝ์— ๋งž์ถ”๊ฑฐ๋‚˜ ์‚ฌ์šฉ์ž ์ •์˜ ์œ ํ˜•์˜ ๋ณ€์ˆ˜๋ฅผ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž ์ •์˜ ์œ ํ˜•์˜ ๋ณ€์ˆ˜์— ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.

๊ตฌ๋ฌธ:


LSet Var As String = Text ๋˜๋Š” LSet Var1 = Var2

๋งค๊ฐœ ๋ณ€์ˆ˜:

Var: ์™ผ์ชฝ์— ๋งž์ถœ ๋ฌธ์ž์—ด์ด ํฌํ•จ๋œ ์ž„์˜์˜ ๋ฌธ์ž์—ด ๋ณ€์ˆ˜์ž…๋‹ˆ๋‹ค.

Text: ๋ฌธ์ž์—ด ๋ณ€์ˆ˜์˜ ์™ผ์ชฝ์— ๋งž์ถœ ๋ฌธ์ž์—ด์ž…๋‹ˆ๋‹ค.

Var1: ๋ณต์‚ฌํ•œ ๋ณ€์ˆ˜๋ฅผ ๋ณต์‚ฌํ•  ์‚ฌ์šฉ์ž ์ •์˜ ์œ ํ˜• ๋ณ€์ˆ˜์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

Var2: ๋‹ค๋ฅธ ๋ณ€์ˆ˜์— ๋ณต์‚ฌํ•  ์‚ฌ์šฉ์ž ์ •์˜ ์œ ํ˜• ๋ณ€์ˆ˜์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

๋ฌธ์ž์—ด์ด ๋ฌธ์ž์—ด ๋ณ€์ˆ˜๋ณด๋‹ค ์งง์„ ๊ฒฝ์šฐ LSet์€ ๋ฌธ์ž์—ด ๋ณ€์ˆ˜ ๋‚ด์—์„œ ๋ฌธ์ž์—ด์„ ์™ผ์ชฝ์œผ๋กœ ๋งž์ถฅ๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด ๋ณ€์ˆ˜์˜ ๋‚˜๋จธ์ง€ ๋ถ€๋ถ„์€ ๋ชจ๋‘ ๊ณต๋ฐฑ์œผ๋กœ ๋ฐ”๋€๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด์ด ๋ฌธ์ž์—ด ๋ณ€์ˆ˜๋ณด๋‹ค ๊ธธ ๊ฒฝ์šฐ ๋งจ ์™ผ์ชฝ ๋ฌธ์ž๊ฐ€ ๋ฌธ์ž์—ด ๋ณ€์ˆ˜ ๊ธธ์ด๋งŒํผ๋งŒ ๋ณต์‚ฌ๋ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ LSet ๋ฌธ์„ ์‚ฌ์šฉํ•˜๋ฉด ์‚ฌ์šฉ์ž ์ •์˜ ์œ ํ˜• ๋ณ€์ˆ˜๋ฅผ ๋™์ผํ•œ ์œ ํ˜•์˜ ๋‹ค๋ฅธ ๋ณ€์ˆ˜์— ๋ณต์‚ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ:


Sub ExampleRLSet
Dim sVar As String
Dim sExpr As String
    sVar = String(40,"*")
    sExpr = "SBX"
    REM Align "SBX" within the 40-character reference string
    REM Replace asterisks with spaces
    RSet sVar = sExpr
    Print ">"; sVar; "<"
    sVar = String(5,"*")
    sExpr = "123457896"
    RSet sVar = sExpr
    Print ">"; sVar; "<"
    sVar = String(40,"*")
    sExpr = "SBX"
    REM Left-align "SBX" within the 40-character reference string
    LSet sVar = sExpr
    Print ">"; sVar; "<"
    sVar = String(5,"*")
    sExpr = "123456789"
    LSet sVar = sExpr
    Print ">"; sVar; "<"
End Sub

Please support us!