Use the following formulas when you want to:
TO
USE
MEASURE THE LENGTH OF A STRING
$StrLen(string)$
EXTRACT THE POSITION OF A SPECIFIC STRING SEGMENT (CASE-SENSITIVE)
$StrPos((where-to-search), what-to-search-for, idx)$
EXTRACT THE POSITION OF A SPECIFIC STRING SEGMENT (NOT CASE-SENSITIVE)
$StrPosNoCase((where-to-search), what-to-search-for, idx)$
EXTRACT STRING SEGMENTS
$SubStrIdx(where-to-search, first-idx[, last-idx])$
EXTRACT A SPECIFIED NUMBER OF SYMBOLS
$SubStrLen((where-to-search, first-idx[, length])$
NOTES
The examples that follow refer to a material named W-12xy EB-WB-00. In the formulas, n0 ensures that no zeroes will appear after the decimal point.
TO DISPLAY
USE
YOU WILL SEE
The number of string items, spaces included
$StrLen((#OneUp1.Material.Name)), n0$
15
The position of the first dash
$StrPos((#OneUp1.Material.Name), "–", 0), n0$
1
The position of the second dash
$StrPos((#OneUp1.Material.Name), "–", 1), n0$
9
The position of the third dash
$StrPos((#OneUp1.Material.Name), "–", 2), n0$
12
The position of the fourth dash
$StrPos((#OneUp1.Material.Name), "–", 3), n0$
–1 There is no fourth dash in the string.
The position of the first dash from right to left
$StrPos((#OneUp1.Material.Name), "–", –1), n0$
3 In right-to-left counting, the first position counts as 1.
The position of the letter "E"
$StrPos((#OneUp1.Material.Name), "EB"), n0$
7
The the position of the letters "eb"
$StrPos((#OneUp1.Material.Name), "eb"), n0$
-1 Because case-sensitivity is respected, the item series "eb" has not been found.
The position of the letter "E"
$StrPosNoCase((#OneUp1.Material.Name), "EB"), n0$
7 The position of the letter "E". No case-sensitivity.
The position of the letter "E"
$StrPosNoCase((#OneUp1.Material.Name), "eb"), n0$
7 The position of the letter "E". No case-sensitivity.
The symbols between two specified string positions
$SubStrIdx((#OneUp1.Material.Name), strpos((#OneUp1.Material.Name), "–", 0)+1, strpos((#OneUp1.Material.Name), "–", 1))$
12xy EB The item series between the first and second specified dashes.
Four items after a specified items
$SubStrLen((#OneUp1.Material.Name), strpos((#OneUp1.Material.Name), "–", 0)+1, 4)$
12xyThe four symbols after the specified dash.