Sv SubString

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender.

Description

Returns a substring of a string variable. Although ported to NVSE, this function was deprecated in OBSE. It is simpler and better to use slice notation instead.

Syntax

[help]
(string) Sv_SubString Source:string_var StartPos:int HowMany:int 

Example

string_var my_string
string_var my_substring

let my_string := "This is my string"

let my_substring := my_string[0:3] ; returns "This" the easy way (the first four characters in the string)

let my_substring := my_string[11:-1] ; returns "string" (a negative value such as -1 proceed from the right end of the string so -1 == string length)

let my_substring := Sv_SubString my_string 0, 4  ; returns "This" using this function

See Also