Sv Split

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender.

Description

Splits the specified string based on the specified delimiter(s) and returns a regular array (list array) containing all substrings. Each character in the set of delimiters is matched individually, not as the complete string it is passed as.

Syntax

[help]
(array) Sv_Split ToSplit:string Delimiters:string JoinDelimiters:bool 

Example

string_var my_string
array_var substrings

let my_string := "What's he building in there?"

let substrings := Sv_Split my_string, " " ; * split on 'space'

; * substrings contains: "What's", "he", "building", "in", "there?"
;2 delimiters

let my_string := "He never waves when he goes by. He's hiding something from the rest of us, and I think I know why."

let substrings := Sv_Split my_string, ",." 

; * substrings contains: "He never waves when he goes by", " He's hiding something from the rest of us", " and I think I know why"
;Join delimiters bool to split at a string.

let my_string := "He never waves when he goes by. He's hiding something from the rest of us, and I think I know why."

let substrings := Sv_Split my_string, "rest" 1

; * substrings contains: "He never waves when he goes by. He's hiding something from the ", " of us, and I think I know why."

See Also