Get part of other string

Syntax

s.left(ss nc)
s.right(ss nc)
s.get(ss from [nc])
s.geta(ss from [nc])

 

Parameters

s - str variable.

ss - source string.

nc - number of characters to copy.

from - 0-based index of first character to copy.

 

Remarks

Get part of ss.

left gets nc characters from the beginning of ss.

right gets nc characters from the end of ss.

get gets nc characters from middle of ss, starting from from. If nc is omitted or negative, gets all right part of ss.

geta - gets and appends.

 

Example

lpstr lp = "notepad.exe"
str s
s.left(lp 2)
 now s is "no"
s.right(lp 3)
 now s is "exe"
s.get(lp 7)
 now s is ".exe"
s.get(lp 1 2)
 now s is "ot"
s.geta(lp 7 1)
 now s is "ot."