skip-to stack-trace
Simics Reference Manual  /  3 Commands  /  3.2 Command List  / 

split-string

Synopsis

split-string [-type] "separator" "string" [-str]

Description

Splits the string argument using the given separator or based on its type. A type is selected by adding the -type flag and providing the name of type in the separator argument. The supported types are ethernet, ipv4, ipv6, filename or path.

If the empty string is used as separator, the command will split at any whitespace.

The return value from the command is a list of strings or integers depending on the type. If a user-supplied separator is used instead of a type, a list of strings is returned. The -str can be used to always get a return value of strings no matter the type.

Supported conversion types:

ethernet
Split Ethernet MAC address into list of six integers.
ipv4
Split IPv4 address in dot-decimal notation into list of four integers.
ipv6
Split IPv6 address in hexadecimal, colon-separated notation into list of eight integers.
filename
Split a filesystem path into a directory part and a filename part.
path
Split a filesystem path into one part for each directory level.

The filename and path types work on both Linux and Windows style filesystem paths independent of the host system.

Examples using pre-defined string types:

"ethernet" "ff:fe:01:55:88:11"[255, 254, 1, 85, 136, 17]
"ipv4" "255.0.0.1"[255, 0, 0, 1]
"ipv6" "2001:db8:85a3::7334"[8193, 3512, 34211, 0, 0, 0, 0, 29492]
"ipv6" "::1"[0,0,0,0,0,0,0,1]
"ipv6" -str "1:ffff::1"["1","ffff","0","0","0","0","0","1"]
"filename" "/"["/", ""]
"filename" "/home/user/x"["/home/user", "x"]
"filename" "\\home\user\x"["\\home\user", "x"]
"filename" "c:\x"["c:\", "x"]
"path" "c:\home\user\x"["c:\", "home", "user", "x"]

Provided By

Simics Core
skip-to stack-trace