Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.3.18 SeparateStr (split a string into separate strings)

Purpose

Splits a specified string at a specified delimiter, and returns the separated string.

Syntax
SeparateStr (String, SeparateChar [, Position])
Arguments
String

Write the string to be split, or specify a variable that stores this value.

SeparateChar

Specify the delimiter as a character string or as a variable that stores this value.

Position

Specify the position from which to split the string as the offset from beginning, where 1 is the first character. The delimiter is not included in the count from the first character.

A zero-length string ("") is returned if the Position value exceeds the number of characters in String.

This value is optional. If you omit this value, 1 is assumed.

Description

The SeparateStr command divides a specified string using the specified delimiter, and returns the string separated from the specified position.

If two or more delimiters occur one after the other in the specified string, a zero-length string ("") is returned as the separated string.

To obtain the number of separate strings, use the SeparateStrCount command.

To include n double quotation marks (") as characters in String, you must enter n*8 double quotation marks. However, if you specify 2 in the following registry, you can use n*2 double quotation marks instead of n*8:

Registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Hitachi\JP1/Script\SPTX
Value name
ParseDQ
Value datatype

REG_DWORD

Value

0: If you are using quotation marks in a parameter string, the setting that allows you to specify n*2 double quotation marks (") is disabled (this is the default value).

1: If you are using quotation marks in a parameter string, the setting that allows you to specify n*2 double quotation marks (") is enabled.

To specify both 1 (see the SetGV, GetGV, and DeleteGV commands) and 2 as the value of this registry, type 3.

When the setting takes effect

The setting takes effect the next time the script file is executed.

Examples
' This code stores "01-00,01-01" in variable string1.
Dim string1
string1 = SeparateStr ("JP1  Script  01-00,01-01","  ",3)
 
' This code stores a zero-length string ("") in variable
' string2.
Dim string2
string2 = SeparateStr ("JP1,Script,01-00,,01-01", ",", 4)
JP1/Script version

Supported from JP1/Script 05-00.